Handling strings keys to css

This commit is contained in:
Zoe Roux
2023-01-09 18:10:49 +09:00
parent c67d964d74
commit 0fcc2cbfe3
4 changed files with 66 additions and 22 deletions
+21 -8
View File
@@ -16,7 +16,7 @@ const Box = ({ children, ...props }: { children?: ReactNode } & Stylable) => {
);
};
export default function Home(props: object) {
export default function Home(props: Stylable) {
const { css } = useYoshiki();
return (
@@ -27,6 +27,7 @@ export default function Home(props: object) {
display: "flex",
paddingLeft: "2rem",
paddingRight: "2rem",
paddingTop: (theme) => theme.background,
bg: (theme) => theme.background,
},
md({
@@ -58,19 +59,31 @@ export default function Home(props: object) {
<div
{...css({
backgroundColor: "green",
hover: {
backgroundColor: "blue",
},
press: {
backgroundColor: "red",
self: {
bg: "red",
},
text: {
color: "white",
},
},
hover: {
text: {
color: "blue",
},
},
focus: {
backgroundColor: "yellow",
self: {
bg: "yellow",
},
text: {
color: "green",
},
},
})}
tabIndex={0}
>
<a href="https://nextjs.org/docs">
<a href="https://nextjs.org/docs" {...css([{ color: "red" }, "text"])}>
<h2>Documentation &rarr;</h2>
<p>Find in-depth information about Next.js features and API.</p>
</a>
@@ -89,7 +102,7 @@ export default function Home(props: object) {
<div
{...css({
hover: {
background: { xs: "red", sm: "blue", md: "green" },
self: { background: { xs: "red", sm: "blue", md: "green" } },
},
})}
>