Skip to content

Commit

Permalink
Update theming docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathewjordan committed Apr 25, 2024
1 parent 467ffc4 commit b2b532c
Show file tree
Hide file tree
Showing 14 changed files with 2,754 additions and 360 deletions.
12 changes: 6 additions & 6 deletions components/Splash/Collection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const SplashCollection = ({ data }) => {
display: "flex",
justifyContent: "flex-end",
}}
grow="1"
flexGrow="1"
mx="5"
>
<MagnifyingGlassIcon style={{ opacity: 0.5 }} />
Expand All @@ -89,29 +89,29 @@ const SplashCollection = ({ data }) => {
</Flex>
</Box>
<Flex gap="3">
<Flex direction="column" grow="1" gap="3" style={{ width: "20%" }}>
<Flex direction="column" flexGrow="1" gap="3" style={{ width: "20%" }}>
<GridItem index={0} />
<GridItem index={5} />
<GridItem index={10} />
<GridItem index={15} />
</Flex>
<Flex direction="column" grow="1" gap="3" style={{ width: "20%" }}>
<Flex direction="column" flexGrow="1" gap="3" style={{ width: "20%" }}>
<GridItem index={1} />
<GridItem index={16} />
<GridItem index={11} />
<GridItem index={16} />
</Flex>
<Flex direction="column" grow="1" gap="3" style={{ width: "20%" }}>
<Flex direction="column" flexGrow="1" gap="3" style={{ width: "20%" }}>
<GridItem index={2} />
<GridItem index={7} />
<GridItem index={12} />
</Flex>
<Flex direction="column" grow="1" gap="3" style={{ width: "20%" }}>
<Flex direction="column" flexGrow="1" gap="3" style={{ width: "20%" }}>
<GridItem index={3} />
<GridItem index={8} />
<GridItem index={13} />
</Flex>
<Flex direction="column" grow="1" gap="3" style={{ width: "20%" }}>
<Flex direction="column" flexGrow="1" gap="3" style={{ width: "20%" }}>
<GridItem index={4} />
<GridItem index={9} />
<GridItem index={14} />
Expand Down
4 changes: 2 additions & 2 deletions components/Splash/Window.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Box, Flex } from "@radix-ui/themes";
import React, { useEffect, useState } from "react";
import { indigo, indigoA, slateA } from "@radix-ui/colors";
import { indigo, slateA } from "@radix-ui/colors";

import { Collection } from "@iiif/presentation-3";
import SplashCollection from "./Collection";
Expand Down Expand Up @@ -84,7 +84,7 @@ const SplashWindow = ({ iiifContent }) => {
</Box>
</Box>
</Box>
<Box grow="1" p="3" style={{ position: "relative" }}>
<Box flexGrow="1" p="3" style={{ position: "relative" }}>
<SplashCollection data={data} />
</Box>
</Flex>
Expand Down
160 changes: 160 additions & 0 deletions components/Theme.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
import {
Box,
Button,
Code,
Flex,
Heading,
Text,
TextField,
Theme,
} from "@radix-ui/themes";

import { MagnifyingGlassIcon } from "@radix-ui/react-icons";
import { themePropDefs } from "@radix-ui/themes/dist/esm/props";

const capitalize = (s) => s[0].toUpperCase() + s.slice(1);

const ColorBlock = ({
color,
level,
width = "calc(100% / 12)",
borderRadius = "none",
}) => {
const backgroundColor = `var(--${color}-${level})`;
return (
<Box
style={{
backgroundColor,
height: "2.618rem",
width,
borderRadius,
}}
/>
);
};

const LabelFromPropValue = ({ value }) => {
return (
<Flex gap="2" style={{ width: "25%" }} align="baseline" flexShrink="0">
<Text size="4" weight="medium">
{capitalize(value)}
</Text>
<Code size="3">{value}</Code>
</Flex>
);
};

const ColorBlockLabeled = ({ color }) => {
return (
<Flex direction="column" gap="2">
<ColorBlock
key={color + 10}
color={color}
level={10}
width="60px"
borderRadius="var(--radius-3)"
/>
<Text size="1" weight="medium">
{capitalize(color)}
</Text>
</Flex>
);
};

const ColorScale = ({ color }) => {
// return scale of 1-12
const scale = Array.from({ length: 12 }, (_, i) => i + 1);

return (
<Flex justify="between" align="center">
<LabelFromPropValue value={color} />
<Flex
flexGrow="1"
style={{
borderRadius: "var(--radius-3)",
overflow: "hidden",
}}
>
{scale.map((level) => (
<ColorBlock key={color + level} color={color} level={level} />
))}
</Flex>
</Flex>
);
};

const Colors = ({ colors }) => {
return (
<Box my="5">
<Flex gap="3" direction="column">
{colors
.filter((color) => color !== "auto")
.map((color) => (
<ColorScale key={color} color={color} />
))}
</Flex>
</Box>
);
};

const ColorsLabeled = ({ colors }) => {
return (
<Box my="5">
<Flex gap="3" wrap="wrap">
{colors
.filter((color) => color !== "auto")
.map((color) => (
<ColorBlockLabeled key={color} color={color} />
))}
</Flex>
</Box>
);
};

const Radius = () => {
return (
<Box my="5">
<Flex gap="5" direction="column">
{themePropDefs.radius.values.map((radius) => (
<Flex justify="between" align="center">
<LabelFromPropValue value={radius} />
<Box flexGrow="1">
<TextField.Root size="3" radius={radius} variant="surface">
<TextField.Slot side="left" pl="3">
<MagnifyingGlassIcon height="20" width="20" />
</TextField.Slot>
<TextField.Slot side="right" pr="1" gap="0">
<Button size="2">Search</Button>
</TextField.Slot>
</TextField.Root>
</Box>
</Flex>
))}
</Flex>
</Box>
);
};

const Scaling = () => {
const text =
"Born in 1793 near Killinick, Ireland, Francis Danby initially gained recognition for his romantic landscapes and atmospheric scenes that captivated the Victorian public. After moving to Bristol, England, he became a key figure in the Bristol School of artists, where he further developed his unique style of using dramatic contrasts and rich, moody colors to evoke powerful emotions. His work, often imbued with themes of the sublime and picturesque, made significant contributions to the British Romantic movement in art.";
return (
<Box my="5">
<Flex gap="5" direction="column">
{themePropDefs.scaling.values.map((value) => (
<Flex justify="between" align="start">
<LabelFromPropValue value={value} />
<Box flexGrow="0" flexShrink="1">
<Theme scaling={value}>
<Heading mb="2">Francis Danby</Heading>
<Text>{text}</Text>
</Theme>
</Box>
</Flex>
))}
</Flex>
</Box>
);
};

export { Colors, ColorsLabeled, Radius, Scaling };
5 changes: 3 additions & 2 deletions next-sitemap.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ module.exports = {
siteUrl: "https://canopy-iiif.github.io/docs",
changefreq: "weekly",
priority: 0.7,
generateRobotsTxt: true,
sitemapSize: 100,
generateIndexSitemap: false,
generateRobotsTxt: true, // (optional)
sitemapSize: 5000,
outDir: "./out",
};
Loading

0 comments on commit b2b532c

Please sign in to comment.