-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
navbar improvements and refactored news
- Loading branch information
Showing
6 changed files
with
102 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Text, Image } from "@chakra-ui/react"; | ||
import { TopBarItem } from "@layout/TopBar/TopBarItem"; | ||
import Link from "@component/Link"; | ||
import Label from "./Label"; | ||
|
||
export const Logo = () => { | ||
return ( | ||
<Link href="/" style={{ height: "100%", textDecoration: "none" }}> | ||
<TopBarItem paddingLeft={0} userSelect="none" pointerEvents="none"> | ||
<Image height="35px" boxSize="35px" src="/images/header.png" alt="shibaac" /> | ||
<Text fontSize="lg" color="white" ml="10px"> | ||
Shibaac | ||
</Text> | ||
<Label fontSize="xs" margin="0" marginLeft={1}> | ||
Alpha | ||
</Label> | ||
</TopBarItem> | ||
</Link> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { Text, VStack, StackProps, HStack, Image, Heading } from "@chakra-ui/react"; | ||
import { IoMdTime } from "react-icons/io"; | ||
import { formatDate } from "@lib/."; | ||
import { HiNewspaper } from "react-icons/hi2"; | ||
import { useColors } from "@hook/useColors"; | ||
import sanitize from "sanitize-html"; | ||
import Link from "./Link"; | ||
|
||
const maxChars = 180; | ||
|
||
export interface NewsCardProps extends StackProps { | ||
header?: string; | ||
date?: string | null; | ||
html: string; | ||
id: string; | ||
image?: string; | ||
} | ||
|
||
export const NewsCard = ({ date, html, header, image, id, ...props }: NewsCardProps) => { | ||
const { bgColor, textColor } = useColors(); | ||
|
||
return ( | ||
<HStack color={textColor} bgColor={bgColor} gap={10} align="start" {...props}> | ||
<Link href={`/news/${id}`}> | ||
<Image | ||
src={image ?? "https://archive.org/download/placeholder-image/placeholder-image.jpg"} | ||
maxW="200px" | ||
alt="Placeholder" | ||
borderRadius="md" | ||
/> | ||
</Link> | ||
<VStack align="start" maxW="100%"> | ||
<Heading size="md">{header}</Heading> | ||
<Text color="whiteAlpha.600" fontSize="xs"> | ||
By author | ||
</Text> | ||
<Text | ||
w="full" | ||
maxW="100%" | ||
marginTop={2} | ||
overflowWrap="break-word" | ||
whiteSpace="normal" | ||
wordBreak="break-word" | ||
fontSize="sm" | ||
dangerouslySetInnerHTML={{ __html: sanitize(html.length > maxChars ? html.slice(0, maxChars) + "..." : html) }} | ||
/> | ||
</VStack> | ||
{/* <Flex bgColor={bgColor} borderBottomWidth="1px" borderTopWidth="1px" borderColor="#ddd" borderRadius={borderRadius}> | ||
<Grid margin="10px" width="100%" templateColumns="1fr auto"> | ||
<Flex flexDirection="row" alignItems="center" gap="5px"> | ||
<HiNewspaper /> | ||
<Text color={textColor}>{header}</Text> | ||
</Flex> | ||
{date && ( | ||
<Box display="flex" alignItems="center" justifyContent="flex-end"> | ||
<IoMdTime /> | ||
<Text>{formatDate(date)}</Text> | ||
</Box> | ||
)} | ||
</Grid> | ||
</Flex> | ||
<Box padding="10px">{isLoading ? <Loader /> : children}</Box> */} | ||
</HStack> | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters