diff --git a/src/sections/Projects/Sistent/identity/typography/code.js b/src/sections/Projects/Sistent/identity/typography/code.js index 159daa3eeca86..58ddc70a5dc4e 100644 --- a/src/sections/Projects/Sistent/identity/typography/code.js +++ b/src/sections/Projects/Sistent/identity/typography/code.js @@ -1,16 +1,371 @@ -import React from "react"; +import React, { useState } from "react"; import { navigate } from "gatsby"; import { useLocation } from "@reach/router"; -import TypeTable1 from "../../../../../assets/images/app/projects/sistent/type-table-1-light.png"; -import TypeTable1Dark from "../../../../../assets/images/app/projects/sistent/type-table-1-dark.png"; - -import TypeTable2 from "../../../../../assets/images/app/projects/sistent/type-table-2-light.png"; -import TypeTable2Dark from "../../../../../assets/images/app/projects/sistent/type-table-2-dark.png"; -import { Col, Row } from "../../../../../reusecore/Layout"; -import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode"; import { SistentLayout } from "../../sistent-layout"; +import { Col, Row } from "../../../../../reusecore/Layout"; import Button from "../../../../../reusecore/Button"; +import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode"; + +import { + styled, + Table, + TableContainer, + TableCell, + TableRow, + TableHead, + TableBody, + SistentThemeProvider, + CustomTooltip, + Box, +} from "@sistent/sistent"; +import { copyToClipboard } from "../../../../../components/CodeBlock/copy-to-clipboard.js"; + +// Table data +const primitiveTokens = [ + { + token: "typeset-1", + size: "64px/4rem", + lineHeight: "80px/5rem", + sample: "Aa", + }, + { + token: "typeset-2", + size: "52px/3.25rem", + lineHeight: "64px/4rem", + sample: "Aa", + }, + { + token: "typeset-3", + size: "32px/2rem", + lineHeight: "40px/2.5rem", + sample: "Aa", + }, + { + token: "typeset-4", + size: "24px/1.5rem", + lineHeight: "36px/2.25rem", + sample: "Aa", + }, + { + token: "typeset-5", + size: "16px/1rem", + lineHeight: "28px/1.75rem", + sample: "Aa", + }, + { + token: "typeset-6", + size: "14px/0.875rem", + lineHeight: "24px/1.5rem", + sample: "Aa", + }, + { + token: "typeset-7", + size: "12px/0.75rem", + lineHeight: "16px/1rem", + sample: "Aa", + }, +]; +const semanticTokens = [ + { + token: "text-h1-bold", + desktop: { + typeface: "Qanelas Soft", + size: "52px / 3.25rem", + lineHeight: "64px / 4rem", + weight: "Bold / 700", + category: "Heading", + case: "Sentence case", + }, + mobile: { + typeface: "Qanelas Soft", + size: "32px / 2rem", + lineHeight: "40px / 2.5rem", + weight: "Bold / 700", + category: "Heading", + case: "Sentence case", + }, + sample: "Aa", + }, + { + token: "text-h2-medium", + desktop: { + typeface: "Qanelas Soft", + size: "32px / 2rem", + lineHeight: "40px / 2.5rem", + weight: "Medium / 500", + category: "Sub-heading", + case: "Title case", + }, + mobile: { + typeface: "Qanelas Soft", + size: "24px / 1.5rem", + lineHeight: "36px / 2.25rem", + weight: "Medium / 500", + category: "Sub-heading", + case: "Title case", + }, + sample: "Aa", + }, + { + token: "text-h3-medium/bold", + desktop: { + typeface: "Qanelas Soft", + size: "24px / 1.5rem", + lineHeight: "36px / 2.25rem", + weight: "Medium / 500", + category: "Sub-heading", + case: "Title case", + }, + mobile: { + typeface: "Qanelas Soft", + size: "16px / 1rem", + lineHeight: "28px / 1.75rem", + weight: "Bold / 700", + category: "Sub-heading", + case: "Sentence case", + }, + sample: "Aa", + }, + { + token: "text-b1-regular", + desktop: { + typeface: "Open Sans", + size: "16px / 1rem", + lineHeight: "28px / 1.75rem", + weight: "Regular / 400", + category: "Body", + case: "Sentence case", + }, + mobile: { + typeface: "Open Sans", + size: "16px / 1rem", + lineHeight: "28px / 1.75rem", + weight: "Regular / 400", + category: "Body", + case: "Sentence case", + }, + sample: "Aa", + }, + { + token: "text-b2-semibold", + desktop: { + typeface: "Open Sans", + size: "16px / 1rem", + lineHeight: "28px / 1.75rem", + weight: "Semi-bold / 600", + category: "Body", + case: "Sentence case", + }, + mobile: { + typeface: "Open Sans", + size: "16px / 1rem", + lineHeight: "28px / 1.75rem", + weight: "Semi-bold / 600", + category: "Body", + case: "Sentence case", + }, + sample: "Aa", + }, + + { + token: "text-b3-regular", + desktop: { + typeface: "Open Sans", + size: "14px / 0.875rem", + lineHeight: "24px / 1.5rem", + weight: "Regular / 400", + category: "Body", + case: "Sentence case", + }, + mobile: { + typeface: "Open Sans", + size: "14px / 0.875rem", + lineHeight: "24px / 1.5rem", + weight: "Regular / 400", + category: "Body", + case: "Sentence case", + }, + sample: "Aa", + }, + { + token: "text-l1-bold", + desktop: { + typeface: "Qanelas Soft", + size: "12px / 0.75rem", + lineHeight: "16px / 1rem", + weight: "Bold / 700", + category: "Label", + case: "Sentence case", + }, + mobile: { + typeface: "Qanelas Soft", + size: "12px / 0.75rem", + lineHeight: "16px / 1rem", + weight: "Bold / 700", + category: "Label", + case: "Sentence case", + }, + sample: "Aa", + }, + { + token: "text-l2-regular", + desktop: { + typeface: "Open Sans", + size: "12px / 0.75rem", + lineHeight: "24px / 1.5rem", + weight: "Regular / 400", + category: "Label", + case: "Sentence case", + }, + mobile: { + typeface: "Open Sans", + size: "12px / 0.75rem", + lineHeight: "24px / 1.5rem", + weight: "Regular / 400", + category: "Label", + case: "Sentence case", + }, + sample: "Aa", + }, + { + token: "text-c1-regular", + desktop: { + typeface: "Consolas", + size: "12px / 0.75rem", + lineHeight: "24px / 1.5rem", + weight: "Regular / 400", + category: "Code", + case: "Sentence case", + }, + mobile: { + typeface: "Consolas", + size: "12px / 0.75rem", + lineHeight: "24px / 1.5rem", + weight: "Regular / 400", + category: "Code", + case: "Sentence case", + }, + sample: "aa", + }, + { + token: "text-c2-regular", + desktop: { + typeface: "Consolas", + size: "16px / 1rem", + lineHeight: "28px / 1.75rem", + weight: "Regular / 400", + category: "Code", + case: "Sentence case", + }, + mobile: { + typeface: "Consolas", + size: "16px / 1rem", + lineHeight: "28px / 1.75rem", + weight: "Regular / 400", + category: "Code", + case: "Sentence case", + }, + sample: "aa", + }, +]; + +const CopyCell = ({ value }) => { + const [copyText, setCopyText] = useState("Copy"); + + const handleCopy = async () => { + await copyToClipboard(value); + setCopyText("Copied"); + setTimeout(() => setCopyText("Copy"), 1000); + }; + return ( + + + theme.palette.action?.hover || "rgba(0, 0, 0, 0.04)", + }, + }} + onClick={handleCopy} + > + {value} + + + ); +}; + +const TypographyPreviewBox = styled("div")( + ({ theme, size, lineHeight, weight, caseStyle, typeface }) => ({ + fontSize: size, + lineHeight: lineHeight, + fontWeight: weight, + fontFamily: typeface || "inherit", + textTransform: + caseStyle === "uppercase" + ? "uppercase" + : caseStyle === "lowercase" + ? "lowercase" + : caseStyle === "capitalize" + ? "capitalize" + : "none", + border: `1px solid ${theme.palette.text.primary}`, + borderRadius: "4px", + display: "flex", + alignItems: "center", + justifyContent: "center", + backgroundColor: theme.palette.background.paper, + width: "80px", + height: "80px", + boxSizing: "border-box", + overflow: "hidden", + color: theme.palette.text.primary, + minWidth: "80px", + minHeight: "80px", + }), +); + +const StyledTableRow = styled(TableRow)(({ theme }) => ({ + "&:nth-of-type(odd)": { + backgroundColor: theme.palette.background.default, + }, + "&:nth-of-type(even)": { + backgroundColor: theme.palette.background.secondary, + }, +})); + +const StyledTableContainer = styled(TableContainer)(() => ({ + width: "100%", + backgroundColor: "transparent", + boxShadow: "none", + padding: 0, +})); + +const StyledTableCell = styled(TableCell)(({ theme }) => ({ + color: theme.palette.text.secondary, + fontSize: "0.975rem", + padding: "0.75rem", + borderBottom: `1px solid ${theme.palette.divider}`, + borderRadius: "4px", + height: "60px", + verticalAlign: "middle", +})); + +const StyledHeaderCell = styled(StyledTableCell)(() => ({ + fontWeight: 600, +})); const TypographyCode = () => { const location = useLocation(); @@ -81,14 +436,47 @@ const TypographyCode = () => { arises, these typesets, serve as the reference size for any new font to be created.

- - - Type Table - - + + + + + + + + + Token + Size + Line Height + Preview + + + + {primitiveTokens.map((t) => ( + + + + + {t.size} + {t.lineHeight} + + + {t.sample} + + + + ))} + +
+
+ +
+
+

Semantic Category

@@ -97,14 +485,111 @@ const TypographyCode = () => { suitable for certain use cases either across all platforms or in any given platform.

- - - Type Table - - + + + + + + + + + Token + Desktop + Preview + Mobile + Preview + + + + {semanticTokens.map((t) => ( + + + + + + Typeface: {t.desktop.typeface} +
+ Size: {t.desktop.size} +
+ Line Height: {t.desktop.lineHeight} +
+ Weight: {t.desktop.weight} +
+ Category: {t.desktop.category} +
+ Case Style: {t.desktop.case} +
+ + + {t.sample} + + + + Typeface: {t.mobile.typeface} +
+ Size: {t.mobile.size} +
+ Line Height: {t.mobile.lineHeight} +
+ Weight: {t.mobile.weight} +
+ Category: {t.mobile.category} +
+ Case Style: {t.mobile.case} +
+ + + {t.sample} + + +
+ ))} +
+
+
+ +
+