1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-06-30 22:46:39 -04:00

separate ThemeContext and useTheme code

This commit is contained in:
2022-04-06 17:40:16 -04:00
parent eccf2108c7
commit 25aed87b21
9 changed files with 165 additions and 175 deletions

View File

@ -1,7 +1,6 @@
import { memo } from "react";
import Selfie from "../Selfie";
import Menu from "../Menu";
import Ukraine from "../Ukraine";
import { styled } from "../../lib/styles/stitches.config";
import type { ComponentProps } from "react";
@ -58,15 +57,12 @@ export type HeaderProps = ComponentProps<typeof Wrapper> & {
};
const Header = ({ sticky, ...rest }: HeaderProps) => (
<>
<Ukraine />
<Wrapper sticky={sticky} {...rest}>
<Nav>
<Selfie />
<ResponsiveMenu />
</Nav>
</Wrapper>
</>
<Wrapper sticky={sticky} {...rest}>
<Nav>
<Selfie />
<ResponsiveMenu />
</Nav>
</Wrapper>
);
export default memo(Header);

View File

@ -33,6 +33,12 @@ const Icon = styled("svg", {
marginRight: "0.6em",
});
const TagsList = styled("span", {
whiteSpace: "normal",
display: "inline-flex",
flexWrap: "wrap",
});
const Tag = styled("span", {
textTransform: "lowercase",
whiteSpace: "nowrap",
@ -62,29 +68,27 @@ const NoteMeta = ({ slug, date, title, htmlTitle, tags = [] }: NoteMetaProps) =>
}}
passHref={true}
>
<MetaLink>
<MetaLink title={formatDateTZ(date)}>
<span>
<Icon as={DateIcon} />
</span>
<span title={formatDateTZ(date)}>{formatDateTZ(date, "MMMM d, yyyy")}</span>
<span>{formatDateTZ(date, "MMMM d, yyyy")}</span>
</MetaLink>
</Link>
</MetaItem>
{tags.length > 0 && (
<MetaItem
css={{
whiteSpace: "normal",
display: "inline-flex",
flexWrap: "wrap",
}}
>
<span>
<MetaItem>
<span title="Tags">
<Icon as={TagIcon} />
</span>
{tags.map((tag) => (
<Tag key={tag}>{tag}</Tag>
))}
<TagsList>
{tags.map((tag) => (
<Tag key={tag} title={tag}>
{tag}
</Tag>
))}
</TagsList>
</MetaItem>
)}