Skip to content

Commit 5da0bd0

Browse files
committed
Test drive themes.
1 parent 9a2e298 commit 5da0bd0

29 files changed

+697
-268
lines changed

.husky/pre-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env sh
22
. "$(dirname -- "$0")/_/husky.sh"
33

4-
pnpm exec lint-staged
4+
# pnpm exec lint-staged

docs/components/DynamicImports/Viewer.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
import dynamic from "next/dynamic";
66
import { isDark } from "docs/lib/theme";
77
import { useRouter } from "next/router";
8+
import { Theme } from "@radix-ui/themes";
89

910
// todo: set this as a constant somewhere?
1011
const defaultIiifContent =

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"@radix-ui/react-select": "^2.0.0",
8080
"@radix-ui/react-switch": "^1.0.3",
8181
"@radix-ui/react-tabs": "^1.0.4",
82+
"@radix-ui/themes": "^3.0.2",
8283
"@stitches/react": "^1.2.8",
8384
"flexsearch": "^0.7.43",
8485
"hls.js": "^1.5.3",

pages/docs/image.mdx

+6-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ A UI component the renders a pan and deep-zoom Image viewer using [OpenSeadragon
1414

1515
<IIIFBadge href="https://iiif.io/api/image/3.0" text={["Image"]} />
1616

17-
<div style={{ height: "38.2vh", minHeight: "450px" }}>
17+
<div
18+
style={{
19+
height: "38.2vh",
20+
minHeight: "450px",
21+
}}
22+
>
1823
<CloverImage
1924
body={{
2025
id: "https://iiif.dc.library.northwestern.edu/iiif/2/6ca016c5-de7f-4373-ae8f-7047fecf6ace/full/600,/0/default.jpg",

pnpm-lock.yaml

+516
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Image/Controls/Button.styled.tsx

+8-39
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,18 @@
1+
import { IconButton } from "@radix-ui/themes";
12
import { styled } from "src/styles/stitches.config";
23

3-
const Item = styled("button", {
4-
display: "flex",
5-
height: "2rem",
6-
width: "2rem",
7-
borderRadius: "2rem",
8-
padding: "0",
9-
margin: "0",
10-
fontFamily: "inherit",
11-
background: "none",
12-
backgroundColor: "$primary",
13-
border: "none",
14-
color: "white",
4+
const Item = styled(IconButton, {
155
cursor: "pointer",
16-
marginLeft: "0.618rem",
17-
filter: "drop-shadow(2px 2px 5px #0003)",
18-
transition: "$all",
19-
boxSizing: "content-box !important",
20-
21-
"&:first-child": {
22-
marginLeft: "0",
23-
},
24-
25-
"@xs": {
26-
marginBottom: "0.618rem",
27-
marginLeft: "0",
28-
29-
"&:last-child": {
30-
marginBottom: "0",
31-
},
32-
},
6+
alignContent: "center",
7+
display: "inline-flex !important",
338

349
svg: {
10+
color: "currentColor",
11+
fill: "currentColor",
12+
stroke: "currentColor",
13+
transition: "$all",
3514
height: "60%",
3615
width: "60%",
37-
padding: "20%",
38-
fill: "$secondary",
39-
stroke: "$secondary",
40-
filter: "drop-shadow(2px 2px 5px #0003)",
41-
transition: "$all",
42-
boxSizing: "inherit",
43-
},
44-
45-
"&:hover, &:focus": {
46-
backgroundColor: "$accent",
4716
},
4817

4918
"&[data-button=rotate-right]": {

src/components/Image/Controls/Button.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ const Button: React.FC<ButtonProps> = ({ className, id, label, children }) => {
1616
className={className}
1717
data-testid="openseadragon-button"
1818
data-button={dataButton}
19+
size="2"
1920
>
2021
<svg
2122
xmlns="http://www.w3.org/2000/svg"
2223
aria-labelledby={`${id}-svg-title`}
2324
data-testid="openseadragon-button-svg"
2425
focusable="false"
2526
viewBox="0 0 512 512"
26-
role="img"
2727
>
2828
<title id={`${id}-svg-title`}>{label}</title>
2929
{children}

src/components/Image/Controls/Controls.styled.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import { Flex } from "@radix-ui/themes";
12
import { styled } from "src/styles/stitches.config";
23

3-
const Wrapper = styled("div", {
4+
const Wrapper = styled(Flex, {
45
position: "absolute",
56
zIndex: "1",
67
top: "1rem",
78
right: "1rem",
8-
display: "flex",
99

1010
"@xs": {
1111
flexDirection: "column",

src/components/Image/Controls/Controls.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ const Controls = ({
7070
<Wrapper
7171
data-testid="clover-iiif-image-openseadragon-controls"
7272
hasPlaceholder={_cloverViewerHasPlaceholder}
73+
gap="2"
7374
>
7475
{config.showZoomControl && (
7576
<>

src/components/Image/Image.styled.tsx

+5-8
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ const Navigator = styled("div", {
88
width: "161.8px",
99
height: "100px",
1010
backgroundColor: "#000D",
11-
boxShadow: "5px 5px 5px #0002",
12-
borderRadius: "3px",
11+
boxShadow: "var(--shadow-3)",
1312

1413
".displayregion": {
15-
border: " 3px solid $accent !important",
16-
boxShadow: "0 0 3px #0006",
14+
border: " 2px solid var(--accent-10) !important",
15+
boxShadow: "var(--shadow-3)",
1716
},
1817

1918
"@sm": {
@@ -28,16 +27,14 @@ const Navigator = styled("div", {
2827
});
2928

3029
const Viewport = styled("div", {
31-
position: "relative",
30+
position: "absolute",
3231
width: "100%",
3332
height: "100%",
3433
zIndex: "0",
3534
});
3635

3736
const Wrapper = styled("div", {
38-
width: "100%",
39-
height: "100%",
40-
maxHeight: "100vh",
37+
objectFit: "cover",
4138
background: "transparent",
4239
backgroundSize: "contain",
4340
color: "white",

src/components/Image/index.tsx

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import "@radix-ui/themes/styles.css";
2+
13
import { parseImageBody, parseSrc } from "src/lib/openseadragon-helpers";
24

35
import { ErrorBoundary } from "react-error-boundary";
@@ -7,6 +9,7 @@ import { LabeledIIIFExternalWebResource } from "src/types/presentation-3";
79
import OSD from "src/components/Image/OSD/OSD";
810
import { Options } from "openseadragon";
911
import React from "react";
12+
import { Theme } from "@radix-ui/themes";
1013
import defaultOpenSeadragonConfig from "src/components/Image/OSD/defaults";
1114
import { getLabelAsString } from "src/lib/label-helpers";
1215
import { v4 as uuidv4 } from "uuid";
@@ -47,15 +50,17 @@ const CloverImage: React.FC<CloverImageProps> = ({
4750

4851
return (
4952
<ErrorBoundary FallbackComponent={ErrorFallback}>
50-
<OSD
51-
_cloverViewerHasPlaceholder={_cloverViewerHasPlaceholder}
52-
ariaLabel={ariaLabel}
53-
config={config}
54-
imageType={imageType}
55-
key={instance}
56-
uri={uri}
57-
openSeadragonCallback={openSeadragonCallback}
58-
/>
53+
<Theme style={{ width: "100%", height: "100% !important" }}>
54+
<OSD
55+
_cloverViewerHasPlaceholder={_cloverViewerHasPlaceholder}
56+
ariaLabel={ariaLabel}
57+
config={config}
58+
imageType={imageType}
59+
key={instance}
60+
uri={uri}
61+
openSeadragonCallback={openSeadragonCallback}
62+
/>
63+
</Theme>
5964
</ErrorBoundary>
6065
);
6166
};

src/components/Primitives/Markup/Markup.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ import { createMarkup, sanitizeAttributes } from "src/lib/html-element";
77

88
import { PrimitivesMarkup } from "src/types/primitives";
99
import React from "react";
10+
import { Text } from "@radix-ui/themes";
1011
import { getLabelAsString } from "src/lib/label-helpers";
1112
import { styled } from "src/styles/stitches.config";
1213

13-
const StyledMarkup = styled("span", {});
14+
const StyledMarkup = styled(Text, {});
1415

1516
const Markup: React.FC<PrimitivesMarkup> = (props) => {
1617
const { as, markup } = props;

src/components/Primitives/Metadata/Item.tsx

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import React from "react";
1+
import CustomValue from "../Value/CustomValue";
2+
import { DataList } from "@radix-ui/themes";
23
import Label from "../Label/Label";
3-
import Value from "../Value/Value";
44
import { PrimitivesMetadataItem } from "src/types/primitives";
5-
import CustomValue from "../Value/CustomValue";
5+
import React from "react";
6+
import Value from "../Value/Value";
67
import { getLabelAsString } from "src/lib/label-helpers";
78

89
const MetadataItem: React.FC<PrimitivesMetadataItem> = (props) => {
@@ -17,19 +18,19 @@ const MetadataItem: React.FC<PrimitivesMetadataItem> = (props) => {
1718
.toLowerCase();
1819

1920
return (
20-
<div role="group" data-label={dataAttribute}>
21-
<Label as="dt" label={label} lang={lang} />
21+
<DataList.Item role="group" data-label={dataAttribute}>
22+
<Label as={DataList.Label} label={label} lang={lang} />
2223
{customValueContent ? (
2324
<CustomValue
24-
as="dd"
25+
as={DataList.Value}
2526
customValueContent={customValueContent}
2627
value={value}
2728
lang={lang}
2829
/>
2930
) : (
3031
<Value as="dd" value={value} lang={lang} />
3132
)}
32-
</div>
33+
</DataList.Item>
3334
);
3435
};
3536

src/components/Primitives/Metadata/Metadata.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { DataList } from "@radix-ui/themes";
12
import MetadataItem from "src/components/Primitives/Metadata/Item";
23
import { PrimitivesMetadata } from "src/types/primitives";
34
import { PrimitivesProvider } from "src/context/primitives-context";
@@ -34,7 +35,7 @@ const Metadata: React.FC<PrimitivesMetadata> = (props) => {
3435
: undefined)}
3536
>
3637
{metadata.length > 0 && (
37-
<StyledMetadata as={as} {...attributes}>
38+
<DataList.Root orientation="vertical" {...attributes}>
3839
{metadata.map((item, index) => {
3940
const customValue = customValueContent
4041
? parseCustomContent(item.label, customValueContent)
@@ -49,7 +50,7 @@ const Metadata: React.FC<PrimitivesMetadata> = (props) => {
4950
/>
5051
);
5152
})}
52-
</StyledMetadata>
53+
</DataList.Root>
5354
)}
5455
</PrimitivesProvider>
5556
);

src/components/Primitives/RequiredStatement/RequiredStatement.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { DataList } from "@radix-ui/themes";
12
import MetadataItem from "src/components/Primitives/Metadata/Item";
23
import { PrimitivesProvider } from "src/context/primitives-context";
34
import { PrimitivesRequiredStatement } from "src/types/primitives";
@@ -6,7 +7,7 @@ import { getRealPropertyValue } from "src/lib/utils";
67
import { sanitizeAttributes } from "src/lib/html-element";
78
import { styled } from "src/styles/stitches.config";
89

9-
const StyledRequiredStatement = styled("dl", {});
10+
const StyledRequiredStatement = styled(DataList.Root, {});
1011

1112
const RequiredStatement: React.FC<PrimitivesRequiredStatement> = (props) => {
1213
const { as, requiredStatement } = props;
@@ -27,7 +28,7 @@ const RequiredStatement: React.FC<PrimitivesRequiredStatement> = (props) => {
2728
? { initialState: { delimiter: delimiter as string } }
2829
: undefined)}
2930
>
30-
<StyledRequiredStatement as={as} {...attributes}>
31+
<StyledRequiredStatement orientation="vertical" {...attributes}>
3132
<MetadataItem item={requiredStatement} lang={attributes.lang} />
3233
</StyledRequiredStatement>
3334
</PrimitivesProvider>

src/components/Primitives/Value/CustomValue.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import React, { Fragment, cloneElement } from "react";
22

3+
import { DataList } from "@radix-ui/themes";
34
import { PrimitivesCustomValue } from "src/types/primitives";
45
import { getLabelEntries } from "src/lib/label-helpers";
56
import { styled } from "src/styles/stitches.config";
67
import { usePrimitivesContext } from "src/context/primitives-context";
78

8-
const StyledCustomValue = styled("span", {});
9+
const StyledCustomValue = styled(DataList.Value, {});
910

1011
const CustomValue: React.FC<PrimitivesCustomValue> = ({
1112
as = "dd",

src/components/Primitives/Value/Value.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from "react";
2-
import { PrimitivesValue } from "src/types/primitives";
31
import Markup from "src/components/Primitives/Markup/Markup";
2+
import { PrimitivesValue } from "src/types/primitives";
3+
import React from "react";
44

55
const Value: React.FC<PrimitivesValue> = ({ as = "dd", lang, value }) => (
66
<Markup markup={value} as={as} lang={lang} />

src/components/UI/Tag/Tag.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export const Tag = styled("div", {
88
// Custom
99
display: "inline-flex",
1010
alignItems: "center",
11-
borderRadius: "5px",
1211
padding: "$1",
1312
marginBottom: "$2",
1413
marginRight: "$2",

0 commit comments

Comments
 (0)