-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Replace: Color Images with Cards and Copiable Code on Sistent Colors page #6477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
M-DEV-1
wants to merge
11
commits into
layer5io:master
Choose a base branch
from
M-DEV-1:M-DEV-1/replace-images-on-colors-page
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7208b7f
replace: images with color cards with copiable hex codes and sistent …
M-DEV-1 f41d7b0
fix: grammar
M-DEV-1 8a48c84
Merge branch 'master' into M-DEV-1/replace-images-on-colors-page
M-DEV-1 9e36add
add: rgb colors
M-DEV-1 9741405
use copy button from sistent, fix rgb format
M-DEV-1 c36e39a
fix: copy button icon
M-DEV-1 8525328
add no-ssr
M-DEV-1 0277257
update and fix the copy icon import
M-DEV-1 131133c
Merge branch 'master' into M-DEV-1/replace-images-on-colors-page
M-DEV-1 8c7cb95
Merge branch 'master' into M-DEV-1/replace-images-on-colors-page
M-DEV-1 2fb8ddf
Merge branch 'master' into M-DEV-1/replace-images-on-colors-page
vishalvivekm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,102 @@ | ||
import React from "react"; | ||
import React, { useState } from "react"; | ||
import { navigate } from "gatsby"; | ||
import { Row, Col } from "../../../../../reusecore/Layout"; | ||
import { useLocation } from "@reach/router"; | ||
import Button from "../../../../../reusecore/Button"; | ||
import { SistentLayout } from "../../sistent-layout"; | ||
import TonalPallete from "../../../../../assets/images/app/projects/sistent/tonal-palettes.png"; | ||
import TonalPalleteDark from "../../../../../assets/images/app/projects/sistent/tonal-palettes-dark.png"; | ||
import ContextVisuals1 from "../../../../../assets/images/app/projects/sistent/context-visuals-1.png"; | ||
import ContextVisuals2 from "../../../../../assets/images/app/projects/sistent/context-visuals-2.png"; | ||
import ContextVisuals3 from "../../../../../assets/images/app/projects/sistent/context-visuals-3.png"; | ||
import ContextVisuals4 from "../../../../../assets/images/app/projects/sistent/context-visuals-4.png"; | ||
import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode"; | ||
import { useTheme, Tooltip, Snackbar, IconButton, styled, NoSsr } from "@layer5/sistent"; | ||
import { SistentLayout } from "../../sistent-layout"; | ||
import ContentCopyIcon from "@mui/icons-material/ContentCopy"; | ||
|
||
const ColorCards = styled("div")(() => ({ | ||
display: "flex", | ||
flexWrap: "wrap", | ||
gap: "2rem", | ||
margin: "2rem 0", | ||
justifyContent: "center", | ||
})); | ||
|
||
const ColorCard = styled("div")(() => ({ | ||
width: "300px", | ||
borderRadius: "8px", | ||
boxShadow: "0px 5px 10px 1px rgba(0, 179, 159, 0.5)", | ||
cursor: "pointer", | ||
userSelect: "none", | ||
})); | ||
|
||
const Swatch = styled("div")(({ color }) => ({ | ||
height: "100px", | ||
borderRadius: "8px 8px 0 0", | ||
color: color, | ||
})); | ||
|
||
const ColorInfo = styled("div")(() => ({ | ||
padding: "1rem", | ||
textAlign: "center", | ||
})); | ||
|
||
const CodeRow = styled("div")(() => ({ | ||
display: "flex", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
gap: "0.5rem", | ||
fontFamily: "monospace", | ||
fontSize: "0.85rem", | ||
userSelect: "text", | ||
padding: "6px 10px", | ||
})); | ||
|
||
const SistentIdentityColor = () => { | ||
const location = useLocation(); | ||
const { isDark } = useStyledDarkMode(); | ||
const theme = useTheme(); | ||
|
||
const colors = [ | ||
{ | ||
name: "Keppel Green", | ||
color: theme.palette.background.brand?.default, | ||
hex: "#00B39F", | ||
token: "theme.palette.background.brand.default", | ||
}, | ||
{ | ||
name: "Caribbean Green", | ||
color: "#00D3A9", | ||
hex: "#00D3A9", | ||
token: "theme.palette.background.graphics.default", | ||
}, | ||
{ | ||
name: "Saffron Yellow", | ||
color: "#EBC017", | ||
hex: "#EBC017", | ||
token: "theme.palette.background.cta.default", | ||
}, | ||
{ | ||
name: "Charcoal", | ||
color: theme.palette.background.default, | ||
hex: "#3C494F", | ||
token: "theme.palette.background.default", | ||
}, | ||
{ | ||
name: "Accent Grey", | ||
color: theme.palette.background.secondary, | ||
hex: "#51636b", | ||
token: "theme.palette.background.secondary", | ||
}, | ||
]; | ||
|
||
const [snackbarOpen, setSnackbarOpen] = useState(false); | ||
const [snackbarMsg, setSnackbarMsg] = useState(""); | ||
|
||
const handleCopy = (text) => { | ||
navigator.clipboard.writeText(text).then(() => { | ||
setSnackbarMsg(`Copied ${text} to clipboard!`); | ||
setSnackbarOpen(true); | ||
}); | ||
}; | ||
|
||
return ( | ||
<SistentLayout title="Color"> | ||
|
@@ -139,16 +221,54 @@ const SistentIdentityColor = () => { | |
to complement these greens and create harmonious implementations. | ||
These five colors combine to form a foundation for the color system. | ||
</p> | ||
<Row Hcenter className="image-container"> | ||
<Col md={8} lg={8} sm={12}> | ||
<img | ||
src={isDark ? TonalPalleteDark : TonalPallete} | ||
alt="Tonal Palette" | ||
/> | ||
</Col> | ||
</Row> | ||
<a id="Layer Hirarchy"> | ||
<h2>Layer Hirarchy</h2> | ||
<NoSsr> | ||
<ColorCards> | ||
{colors.map(({ name, color, hex, token }, idx) => ( | ||
<ColorCard key={idx}> | ||
<Swatch color={color} /> | ||
<ColorInfo> | ||
<h4>{name}</h4> | ||
<CodeRow> | ||
<span>HEX: {hex}</span> | ||
<Tooltip title="Copy HEX"> | ||
<IconButton | ||
onClick={() => handleCopy(hex)} | ||
aria-label={`Copy HEX color code of ${name}`} | ||
sx={{ | ||
color: theme.palette.icon?.default, | ||
"&:hover": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this doesn't seem to render correctly |
||
color: theme.palette.icon?.brand, | ||
}, | ||
}} | ||
> | ||
<ContentCopyIcon /> | ||
</IconButton> | ||
</Tooltip> | ||
</CodeRow> | ||
<CodeRow> | ||
<span>Sistent Token</span> | ||
<Tooltip title={`Copy Token: ${token}`}> | ||
<IconButton | ||
onClick={() => handleCopy(token)} | ||
aria-label={`Copy Sistent token of ${name}`} | ||
sx={{ | ||
color: theme.palette.icon?.default, | ||
"&:hover": { | ||
color: theme.palette.icon?.brand, | ||
}, | ||
}} | ||
> | ||
<ContentCopyIcon /> | ||
</IconButton> | ||
</Tooltip> | ||
</CodeRow> | ||
</ColorInfo> | ||
</ColorCard> | ||
))} | ||
</ColorCards> | ||
</NoSsr> | ||
<a id="Layer Hierarchy"> | ||
<h2>Layer Hierarchy</h2> | ||
</a> | ||
<p> | ||
For backgrounds and surfaces, colors in the neutral palettes are | ||
|
@@ -254,6 +374,12 @@ const SistentIdentityColor = () => { | |
</p> | ||
</div> | ||
</div> | ||
<Snackbar | ||
open={snackbarOpen} | ||
autoHideDuration={1500} | ||
onClose={() => setSnackbarOpen(false)} | ||
message={snackbarMsg} | ||
/> | ||
</SistentLayout> | ||
); | ||
}; | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
colors aren't rendering from the sistent tokens, not sure why