diff --git a/packages/paste-website/package.json b/packages/paste-website/package.json index ba6ff56969..0d8f7c3fa1 100644 --- a/packages/paste-website/package.json +++ b/packages/paste-website/package.json @@ -151,6 +151,8 @@ "deepmerge": "4.2.2", "dogapi": "^2.8.4", "dotenv": "^16.0.0", + "embla-carousel-autoplay": "^8.0.0", + "embla-carousel-react": "^8.0.0", "github-slugger": "^2.0.0", "globby-esm": "npm:globby@^13.1.3", "gpt3-tokenizer": "^1.1.5", diff --git a/packages/paste-website/src/components/color-swatch/ColorGradient.tsx b/packages/paste-website/src/components/color-swatch/ColorGradient.tsx index 99d1304c76..b4ebcfc5a4 100644 --- a/packages/paste-website/src/components/color-swatch/ColorGradient.tsx +++ b/packages/paste-website/src/components/color-swatch/ColorGradient.tsx @@ -48,25 +48,50 @@ const StyledGradientSwatch = styled.div<{ backgroundColor: string }>` height: ${themeGet("space.space60")}; `; -const StyledGradientSwatchTall = styled.div<{ backgroundColor: string }>` -background-color: ${(props: any) => props.backgroundColor}; -height: ${themeGet("space.space120")}; -`; - -export const ColorGradient: React.FC> = ({ - aliasPrefix, - makeTall = "false", -}) => { +const StyledGradientSwatchTall = styled.div<{ backgroundColor: string; rounded: boolean }>((props) => { + return { + backgroundColor: props.backgroundColor, + // @ts-expect-error this works fine + height: props.theme.space.space120, + // @ts-expect-error this works fine + borderBottomLeftRadius: props.rounded ? props.theme.radii.borderRadius20 : 0, + // @ts-expect-error this works fine + borderBottomRightRadius: props.rounded ? props.theme.radii.borderRadius20 : 0, + }; +}); + +export const ColorGradient: React.FC< + React.PropsWithChildren<{ aliasPrefix: string; makeTall?: boolean; index?: number }> +> = ({ aliasPrefix, makeTall = "false", index = 0 }) => { + const [show, setShow] = React.useState(false); const { theme } = useDarkModeContext(); const aliasValues = getAliasValuesFromPrefix(aliasPrefix, theme); + const count = aliasValues.length - 1; + + function handleVisibilityChange(isVisible: boolean): void { + if (!show) { + setTimeout(() => { + setShow(isVisible); + }, index * 50); + } + } + + const styles = useSpring({ + opacity: show ? 1 : 0.1, + config: { + duration: 500, + }, + }); if (makeTall) { return ( - - {aliasValues.map((aliasValue) => ( - - ))} - + + + {aliasValues.map((aliasValue, _index) => ( + + ))} + + ); } return ( @@ -79,36 +104,21 @@ export const ColorGradient: React.FC = ({ omitGrays = false }): JSX.Element => { - const [show, setShow] = React.useState(false); - - function handleVisibilityChange(isVisible: boolean): void { - if (!show) { - setShow(isVisible); - } - } - - const styles = useSpring({ - opacity: show ? 1 : 0.1, - }); - if (omitGrays) return ( - - - {aliasPrefixes - .filter((prefix) => prefix !== "palette-gray") - .map((prefix) => ( - - ))} - - + + {aliasPrefixes + .filter((prefix) => prefix !== "palette-gray") + .map((prefix, index) => ( + + ))} + ); return ( diff --git a/packages/paste-website/src/components/homepage/Accessibility.tsx b/packages/paste-website/src/components/homepage/Accessibility.tsx index 9a1acce6a4..0f68d362fc 100644 --- a/packages/paste-website/src/components/homepage/Accessibility.tsx +++ b/packages/paste-website/src/components/homepage/Accessibility.tsx @@ -53,48 +53,50 @@ const Accessibility: React.FC = (): React.ReactElement => { - - - Focus management - Screen reader support - Keyboard support - - - - -