diff --git a/src/page-components/scheme/m3-scheme/Preview.module.css b/src/page-components/scheme/m3-scheme/Preview.module.css new file mode 100644 index 0000000..b7d43be --- /dev/null +++ b/src/page-components/scheme/m3-scheme/Preview.module.css @@ -0,0 +1,88 @@ +@layer pages { + .preview_layout { + padding: var(--spacing-s) var(--spacing-m); + width: 100%; + display: flex; + flex-direction: column; + align-items: stretch; + gap: var(--spacing-m); + } + .preview_block { + width: inherit; + padding: var(--spacing-m) var(--spacing-m); + display: flex; + flex-direction: column; + gap: var(--spacing-m); + font-size: var(--font-size-xs); + line-height: 1.1em; + .main_grid { + display: grid; + grid-template-columns: 3fr 1fr; + gap: var(--spacing-m); + .main_color_sets { + grid-column: 1; + display: flex; + flex-direction: row; + justify-content: space-evenly; + align-items: stretch; + gap: var(--spacing-xs); + } + .surface_sets { + grid-column: 1; + display: flex; + flex-direction: column; + align-items: stretch; + gap: var(--spacing-xs); + .surface_basics { + flex-grow: 1; + display: grid; + grid-template-columns: repeat(3, 1fr); + gap: 0; + } + .surface_levels { + flex-grow: 1; + display: grid; + grid-template-columns: repeat(5, 1fr); + gap: 0; + } + .surface_variants { + display: grid; + grid-template-columns: repeat(4, 1fr); + gap: 0; + } + } + .additional_sets { + display: flex; + flex-direction: column; + align-items: stretch; + gap: var(--spacing-xs); + .constants { + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: var(--spacing-s); + } + } + } + h4 { + font-size: var(--font-size-m); + font-weight: bold; + line-height: 1.7em; + } + } + .vertical_set { + flex: 1; + display: flex; + flex-direction: column; + align-items: stretch; + } + .horizontal_set { + display: flex; + flex-direction: row; + justify-content: space-evenly; + align-items: stretch; + gap: 0; + } + .color_block { + padding: var(--spacing-s) var(--spacing-xs); + } +} diff --git a/src/page-components/scheme/m3-scheme/Preview.tsx b/src/page-components/scheme/m3-scheme/Preview.tsx new file mode 100644 index 0000000..2672506 --- /dev/null +++ b/src/page-components/scheme/m3-scheme/Preview.tsx @@ -0,0 +1,272 @@ +import { ScrollArea } from '../../../components/ScrollArea'; +import { + Baseline, + ColorSet, + MaterialDesign3SchemeStorage, + Surface, +} from '../../../material-3-scheme'; +import { SchemeContent } from '../../../models'; +import styles from './Preview.module.css'; + +type ColorSetProps = { + name: string; + set: ColorSet; +}; + +function VerticalColorSet({ name, set }: ColorSetProps) { + return ( +
+
+ {name} +
+
+ On {name} +
+
+ {name} Container +
+
+ On {name} Container +
+
+ ); +} + +function HorizontalColorSet({ name, set }: ColorSetProps) { + return ( +
+
+ {name} +
+
+ On {name} +
+
+ {name} Container +
+
+ On {name} Container +
+
+ ); +} + +type SurfaceColorSetProps = { + surface: Surface; + outline: string; + outlineVariant: string; +}; + +function SurfaceColorSet({ surface, outline, outlineVariant }: SurfaceColorSetProps) { + return ( +
+
+
+ Surface Dim +
+
+ Surface +
+
+ Surface Bright +
+
+
+
+ Surf. Container Lowest +
+
+ Surf. Container Low +
+
+ Surf. Container +
+
+ Surf. Container High +
+
+ Surf. Container Highest +
+
+
+
+ On Surface +
+
+ On Surface Var. +
+
+ Outline +
+
+ Outline Variant +
+
+
+ ); +} + +type AdditionalColorSetsProps = { + baseline: Baseline; +}; + +function AdditionalColorSets({ baseline }: AdditionalColorSetsProps) { + return ( +
+
+ Inverse Surface +
+
+ Inverse On Surface +
+
+ Inverse Primary +
+
+
+ Scrim +
+
+ Shadow +
+
+
+ ); +} + +type PreviewBlockProps = { + title: string; + baseline: Baseline; +}; + +function PreviewBlock({ title, baseline }: PreviewBlockProps) { + return ( +
+

{title}

+
+
+ + + +
+ + + +
+ {Object.entries(baseline.customs).map(([name, set], index) => ( + + ))} +
+ ); +} + +type M3SchemePreviewProps = { + scheme: SchemeContent; +}; + +export function M3SchemePreview({ scheme }: M3SchemePreviewProps) { + return ( + +
+ + +
+
+ ); +}