|
1 | | -import React from "react"; |
| 1 | +import React, { useState } from "react"; |
2 | 2 | import { navigate } from "gatsby"; |
3 | 3 | import { Row, Col } from "../../../../../reusecore/Layout"; |
4 | 4 | import { useLocation } from "@reach/router"; |
5 | 5 | import Button from "../../../../../reusecore/Button"; |
6 | | -import { SistentLayout } from "../../sistent-layout"; |
7 | | -import TonalPallete from "../../../../../assets/images/app/projects/sistent/tonal-palettes.png"; |
8 | | -import TonalPalleteDark from "../../../../../assets/images/app/projects/sistent/tonal-palettes-dark.png"; |
9 | 6 | import ContextVisuals1 from "../../../../../assets/images/app/projects/sistent/context-visuals-1.png"; |
10 | 7 | import ContextVisuals2 from "../../../../../assets/images/app/projects/sistent/context-visuals-2.png"; |
11 | 8 | import ContextVisuals3 from "../../../../../assets/images/app/projects/sistent/context-visuals-3.png"; |
12 | 9 | import ContextVisuals4 from "../../../../../assets/images/app/projects/sistent/context-visuals-4.png"; |
13 | | -import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode"; |
| 10 | +import { useTheme, Tooltip, Snackbar, IconButton, styled, NoSsr } from "@sistent/sistent"; |
| 11 | +import { SistentLayout } from "../../sistent-layout"; |
| 12 | +import ContentCopyIcon from "@mui/icons-material/ContentCopy"; |
| 13 | + |
| 14 | +const ColorCards = styled("div")(() => ({ |
| 15 | + display: "flex", |
| 16 | + flexWrap: "wrap", |
| 17 | + gap: "2rem", |
| 18 | + margin: "2rem 0", |
| 19 | + justifyContent: "center", |
| 20 | +})); |
| 21 | + |
| 22 | +const ColorCard = styled("div")(() => ({ |
| 23 | + width: "300px", |
| 24 | + borderRadius: "8px", |
| 25 | + boxShadow: "0px 5px 10px 1px rgba(0, 179, 159, 0.5)", |
| 26 | + cursor: "pointer", |
| 27 | + userSelect: "none", |
| 28 | +})); |
| 29 | + |
| 30 | +const Swatch = styled("div")(({ color }) => ({ |
| 31 | + height: "100px", |
| 32 | + borderRadius: "8px 8px 0 0", |
| 33 | + backgroundColor: color, |
| 34 | +})); |
| 35 | + |
| 36 | +const ColorInfo = styled("div")(() => ({ |
| 37 | + padding: "1rem", |
| 38 | + textAlign: "center", |
| 39 | +})); |
| 40 | + |
| 41 | +const CodeRow = styled("div")(() => ({ |
| 42 | + display: "flex", |
| 43 | + alignItems: "center", |
| 44 | + justifyContent: "center", |
| 45 | + gap: "0.5rem", |
| 46 | + fontFamily: "monospace", |
| 47 | + fontSize: "0.85rem", |
| 48 | + userSelect: "text", |
| 49 | + padding: "6px 10px", |
| 50 | +})); |
14 | 51 |
|
15 | 52 | const SistentIdentityColor = () => { |
16 | 53 | const location = useLocation(); |
17 | | - const { isDark } = useStyledDarkMode(); |
| 54 | + const theme = useTheme(); |
| 55 | + |
| 56 | + const colors = [ |
| 57 | + { |
| 58 | + name: "Keppel Green", |
| 59 | + color: "#00B39F", |
| 60 | + hex: "#00B39F", |
| 61 | + rgb: "rgb(0, 179, 159)", |
| 62 | + token: "theme.palette.background.brand.default", |
| 63 | + }, |
| 64 | + { |
| 65 | + name: "Caribbean Green", |
| 66 | + color: "#00D3A9", |
| 67 | + hex: "#00D3A9", |
| 68 | + rgb: "rgb(0, 211, 169)", |
| 69 | + token: "theme.palette.background.graphics.default", |
| 70 | + }, |
| 71 | + { |
| 72 | + name: "Saffron Yellow", |
| 73 | + color: "#EBC017", |
| 74 | + hex: "#EBC017", |
| 75 | + rgb: "rgb(235, 192, 23)", |
| 76 | + token: "theme.palette.background.cta.default", |
| 77 | + }, |
| 78 | + { |
| 79 | + name: "Charcoal", |
| 80 | + color: "#3C494F", |
| 81 | + hex: "#3C494F", |
| 82 | + rgb: "rgb(60, 73, 79)", |
| 83 | + token: "theme.palette.background.default", |
| 84 | + }, |
| 85 | + { |
| 86 | + name: "Accent Grey", |
| 87 | + color: "#647881", |
| 88 | + hex: "#647881", |
| 89 | + rgb: "rgb(100, 120, 129)", |
| 90 | + token: "theme.palette.background.secondary", |
| 91 | + }, |
| 92 | + ]; |
| 93 | + |
| 94 | + const [snackbarOpen, setSnackbarOpen] = useState(false); |
| 95 | + const [snackbarMsg, setSnackbarMsg] = useState(""); |
| 96 | + |
| 97 | + const handleCopy = (text) => { |
| 98 | + navigator.clipboard.writeText(text).then(() => { |
| 99 | + setSnackbarMsg(`Copied ${text} to clipboard!`); |
| 100 | + setSnackbarOpen(true); |
| 101 | + }); |
| 102 | + }; |
18 | 103 |
|
19 | 104 | return ( |
20 | 105 | <SistentLayout title="Color"> |
@@ -139,16 +224,71 @@ const SistentIdentityColor = () => { |
139 | 224 | to complement these greens and create harmonious implementations. |
140 | 225 | These five colors combine to form a foundation for the color system. |
141 | 226 | </p> |
142 | | - <Row Hcenter className="image-container"> |
143 | | - <Col md={8} lg={8} sm={12}> |
144 | | - <img |
145 | | - src={isDark ? TonalPalleteDark : TonalPallete} |
146 | | - alt="Tonal Palette" |
147 | | - /> |
148 | | - </Col> |
149 | | - </Row> |
150 | | - <a id="Layer Hirarchy"> |
151 | | - <h2>Layer Hirarchy</h2> |
| 227 | + <NoSsr> |
| 228 | + <ColorCards> |
| 229 | + {colors.map(({ name, color, hex, token, rgb }, idx) => ( |
| 230 | + <ColorCard key={idx}> |
| 231 | + <Swatch color={color} /> |
| 232 | + <ColorInfo> |
| 233 | + <h4>{name}</h4> |
| 234 | + <CodeRow> |
| 235 | + <span>HEX: {hex}</span> |
| 236 | + <Tooltip title="Copy HEX"> |
| 237 | + <IconButton |
| 238 | + onClick={() => handleCopy(hex)} |
| 239 | + aria-label={`Copy HEX color code of ${name}`} |
| 240 | + sx={{ |
| 241 | + color: theme.palette.icon?.default, |
| 242 | + "&:hover": { |
| 243 | + color: theme.palette.icon?.brand, |
| 244 | + }, |
| 245 | + }} |
| 246 | + > |
| 247 | + <ContentCopyIcon /> |
| 248 | + </IconButton> |
| 249 | + </Tooltip> |
| 250 | + </CodeRow> |
| 251 | + <CodeRow> |
| 252 | + <span>Sistent Token</span> |
| 253 | + <Tooltip title={`Copy Token: ${token}`}> |
| 254 | + <IconButton |
| 255 | + onClick={() => handleCopy(token)} |
| 256 | + aria-label={`Copy Sistent token of ${name}`} |
| 257 | + sx={{ |
| 258 | + color: theme.palette.icon?.default, |
| 259 | + "&:hover": { |
| 260 | + color: theme.palette.icon?.brand, |
| 261 | + }, |
| 262 | + }} |
| 263 | + > |
| 264 | + <ContentCopyIcon /> |
| 265 | + </IconButton> |
| 266 | + </Tooltip> |
| 267 | + </CodeRow> |
| 268 | + <CodeRow> |
| 269 | + <span>RGB</span> |
| 270 | + <Tooltip title={`Copy RBG: ${rgb}`}> |
| 271 | + <IconButton |
| 272 | + onClick={() => handleCopy(rgb)} |
| 273 | + aria-label={`Copy RGB of ${name}`} |
| 274 | + sx={{ |
| 275 | + color: theme.palette.icon?.default, |
| 276 | + "&:hover": { |
| 277 | + color: theme.palette.icon?.brand, |
| 278 | + }, |
| 279 | + }} |
| 280 | + > |
| 281 | + <ContentCopyIcon /> |
| 282 | + </IconButton> |
| 283 | + </Tooltip> |
| 284 | + </CodeRow> |
| 285 | + </ColorInfo> |
| 286 | + </ColorCard> |
| 287 | + ))} |
| 288 | + </ColorCards> |
| 289 | + </NoSsr> |
| 290 | + <a id="Layer Hierarchy"> |
| 291 | + <h2>Layer Hierarchy</h2> |
152 | 292 | </a> |
153 | 293 | <p> |
154 | 294 | For backgrounds and surfaces, colors in the neutral palettes are |
@@ -254,6 +394,12 @@ const SistentIdentityColor = () => { |
254 | 394 | </p> |
255 | 395 | </div> |
256 | 396 | </div> |
| 397 | + <Snackbar |
| 398 | + open={snackbarOpen} |
| 399 | + autoHideDuration={1500} |
| 400 | + onClose={() => setSnackbarOpen(false)} |
| 401 | + message={snackbarMsg} |
| 402 | + /> |
257 | 403 | </SistentLayout> |
258 | 404 | ); |
259 | 405 | }; |
|
0 commit comments