Skip to content

Commit

Permalink
Dark mode alias tokens and CDS component tokens (#32)
Browse files Browse the repository at this point in the history
Co-authored-by: Jaalah Ramos <jaalah.ramos@gmail.com>
  • Loading branch information
davyd-akamai and jaalah authored Feb 23, 2024
1 parent eab429c commit c251f12
Show file tree
Hide file tree
Showing 72 changed files with 23,981 additions and 9,971 deletions.
Binary file added .yarn/install-state.gz
Binary file not shown.
893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.1.0.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.1.0.cjs
2 changes: 1 addition & 1 deletion config/dark/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type {

const {
Color,
Elevation,
Font,
Spacing
} = TokensTheme.default.Global;
Expand All @@ -18,6 +17,7 @@ const {
Background,
Border,
Content,
Elevation,
Interaction,
} = TokensTheme.default.Alias;

Expand Down
2 changes: 1 addition & 1 deletion config/densedDark/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type {

const {
Color,
Elevation,
Font,
Spacing
} = TokensTheme.default.Global;
Expand All @@ -18,6 +17,7 @@ const {
Background,
Border,
Content,
Elevation,
Interaction,
} = TokensTheme.default.Alias;

Expand Down
2 changes: 1 addition & 1 deletion config/densedLight/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type {

const {
Color,
Elevation,
Font,
Spacing
} = TokensTheme.default.Global;
Expand All @@ -18,6 +17,7 @@ const {
Background,
Border,
Content,
Elevation,
Interaction,
} = TokensTheme.default.Alias;

Expand Down
2 changes: 1 addition & 1 deletion config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type {

const {
Color,
Elevation,
Font,
Spacing
} = TokensTheme.default.Global;
Expand All @@ -18,6 +17,7 @@ const {
Background,
Border,
Content,
Elevation,
Interaction,
} = TokensTheme.default.Alias;

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@linode/design-language-system",
"version": "1.2.0",
"version": "2.0.0",
"type": "module",
"module": "dist/index.js",
"exports": {
Expand Down Expand Up @@ -76,5 +76,6 @@
},
"volta": {
"node": "18.14.1"
}
},
"packageManager": "yarn@4.1.0"
}
18 changes: 14 additions & 4 deletions stories/ColorSwatch.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
import React from 'react';
import { Border } from '../dist/index.js';
import { Border, Elevation } from '../dist/index.js';

interface ColorSwatchProps {
/**
* The color to display
*/
color: string;
/**
* The elevation to display
*/
elevation: string;
/**
* The shape of the swatch
*/
shape: 'circle' | 'square';
}

export const ColorSwatch = ({ color }: ColorSwatchProps) => {
export const ColorSwatch = ({ color, elevation, shape }: ColorSwatchProps) => {
console.log(elevation)
return (
<div
style={{
backgroundColor: color,
border: `1px solid ${Border.Normal}`,
borderRadius: '50%',
borderRadius: shape === 'square' ? '0' : '50%',
flexShrink: 0,
height: '50px',
width: '50px'
width: '50px',
boxShadow: elevation
}}
/>
);
Expand Down
10 changes: 6 additions & 4 deletions stories/Info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@ import { Typography } from './Typography';
import { formatValue } from './utils';

interface TokenInfoProps {
concept?: string;
color: string;
concept?: string;
shape?: 'circle' | 'square';
state?: string;
type?: string;
value?: string;
variant: string;
}

export const TokenInfo = ({
concept,
color,
concept,
shape = 'circle',
state = '',
type = 'global',
value,
variant
variant,
}: TokenInfoProps) => {
const hasCategory = type !== 'global';
const jsConcept = concept ? `${concept}.` : '';
Expand All @@ -36,7 +38,7 @@ export const TokenInfo = ({
padding: '.5rem'
}}
>
<ColorSwatch color={color} />
<ColorSwatch color={color} shape={shape} elevation={variant === 'Elevation' ? color : undefined}/>
<div>
<Typography key={value} format={'Hex'} value={color} />
<Typography
Expand Down
11 changes: 10 additions & 1 deletion stories/Section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Border, Font } from '../dist/index.js';

interface SectionProps {
concept?: string;
shape?: 'circle' | 'square';
stacked?: boolean;
state?: string;
title: string;
Expand All @@ -25,7 +26,13 @@ export const Section = ({
const isColorValueString = typeof value === 'string';

const renderValue = (
<TokenInfo type={type} color={value} variant={concept} value={variant} />
<TokenInfo
color={value}
shape={concept === 'Elevation' ? 'square' : 'circle'}
type={type}
value={variant}
variant={concept}
/>
);

const renderInfo = isColorValueString
Expand All @@ -36,6 +43,7 @@ export const Section = ({
<Section
concept={concept}
key={key}
shape={concept === 'Elevation' ? 'square' : 'circle'}
stacked
state={key}
title={key}
Expand All @@ -50,6 +58,7 @@ export const Section = ({
color={value as string}
concept={concept}
key={state}
shape={concept === 'Elevation' ? 'square' : 'circle'}
state={state}
type={type}
value={key}
Expand Down
14 changes: 12 additions & 2 deletions stories/alias/AliasColors.stories.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import type { Meta, StoryObj } from '@storybook/react';
import { Action,
import {
Action,
Background,
Border,
Content,
Interaction, } from '../../dist/index.js';
Interaction,
Elevation
} from '../../dist/index.js';
import { AliasColors } from './AliasColors';

const meta = {
Expand Down Expand Up @@ -55,3 +58,10 @@ export const Interactions: Story = {
conceptHeading: 'Interaction'
},
};

export const Elevations: Story = {
args: {
concept: Elevation,
conceptHeading: 'Elevation'
},
};
55 changes: 53 additions & 2 deletions tokens/$metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,60 @@
"alias/densedLight",
"alias/dark",
"alias/densedDark",
"components/appBar/appBar",
"components/advancedSearch/advancedSearch",
"components/bars/appbar",
"components/badge/badge",
"components/breadcrumb/breadcrumb",
"components/button/button",
"components/button/menuButton",
"components/button/overflowMenuButton",
"components/button/splitMenuButton",
"components/button/segmentedButton",
"components/calendar/calendar",
"components/card/card",
"components/checkbox/checkbox",
"components/container/container",
"components/table/table"
"components/contentPanel/contentPanel",
"components/dateField/dateField",
"components/datePicker/datePicker",
"components/dateRangePicker/dateRangePicker",
"components/dateRangeField/dateRangeField",
"components/dateRangeInput/dateRangeInput",
"components/divider/divider",
"components/drawer/drawer",
"components/dropdown/dropdown",
"components/globals/header",
"components/globals/footer",
"components/groupSelect/groupSelect",
"components/inlineEdit/inlineEdit",
"components/kpiBar/kpiBar",
"components/label/label",
"components/list/list",
"components/masterSwitch/masterSwitch",
"components/modal/modal",
"components/notificatioBanner/notificationBanner",
"components/notificationToast/notificationToast",
"components/numericSpinner/numericSpinner",
"components/pagination/pagination",
"components/popover/popover",
"components/progressBar/progressBar",
"components/radioButton/radioButton",
"components/search/search",
"components/sideNavigation/sideNavigation",
"components/select/select",
"components/sidePanel/sidePanel",
"components/stepper/stepper",
"components/switch/switch",
"components/tabs/tabs",
"components/table/table",
"components/tagInput/tag",
"components/tagInput/tagInput",
"components/textArea/textArea",
"components/textField/textField",
"components/timePicker/timePicker",
"components/tooltip/tooltip",
"components/tree/tree",
"components/widgets/upload",
"components/widgets/download"
]
}
Loading

0 comments on commit c251f12

Please sign in to comment.