Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

Commit

Permalink
refactor: remove examples, remove some weight variants
Browse files Browse the repository at this point in the history
  • Loading branch information
Шараев Айнур Раильевич committed Jul 6, 2021
1 parent 82cc5c6 commit 5a9f20d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 200 deletions.
26 changes: 9 additions & 17 deletions src/lib/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,47 +55,39 @@ export const Global = styled.div`
priorityName: 'primary',
paletteName: 'primary',
bwPaletteName: 'bw',
weight: 'filled',
weight: 'fill',
})}
${createPriority({
priorityName: 'secondary',
paletteName: 'secondary',
bwPaletteName: 'bw',
weight: 'filled',
weight: 'fill',
})}
${createPriority({
priorityName: 'default',
bwPaletteName: 'bw',
weight: 'filled',
weight: 'fill',
})}
${createPriority({
priorityName: 'goast',
priorityName: 'white',
bwPaletteName: 'bw',
weight: 'transparent',
weight: 'outline',
})}
${createPriority({
priorityName: 'danger',
paletteName: 'danger',
bwPaletteName: 'bw',
weight: 'filled',
weight: 'fill',
})}
/** for examples of priorities in button */
${createPriority({
priorityName: 'primary-goast',
paletteName: 'primary',
bwPaletteName: 'bw',
weight: 'transparent',
})}
${createPriority({
priorityName: 'secondary-goast',
paletteName: 'secondary',
priorityName: 'success',
paletteName: 'success',
bwPaletteName: 'bw',
weight: 'transparent',
weight: 'fill',
})}
`;
17 changes: 8 additions & 9 deletions src/lib/priority.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ interface PriorityType {
bwPaletteName: string;
paletteName?: string;
priorityName: string;
weight: 'filled' | 'outlined' | 'transparent';
weight: 'fill' | 'outline';
}

export const createPriority = ({
Expand All @@ -14,46 +14,45 @@ export const createPriority = ({
weight,
}: PriorityType) => {
const palette = paletteName || bwPaletteName;

const colors: Record<string, string> = {
'shape-default': 'transparent',
'shape-disabled': `hsla(var(--${palette}-200), 1)`,
'shape-hover': 'transparent',
'shape-active': 'transparent',

'shape-text-default': `hsla(var(--${bwPaletteName}-0), 1)`,
'shape-text-disabled': `hsla(var(--${palette}-300), 1)`,
'shape-text-hover': `hsla(var(--${bwPaletteName}-600), 1)`,
'shape-text-active': `hsla(var(--${bwPaletteName}-700), 1)`,

'canvas-default': `transparent`,
'canvas-disabled': `hsla(var(--${bwPaletteName}-200), 1)`,
'canvas-hover': `transparent`,
'canvas-active': `transparent`,

'canvas-text-default': `hsla(var(--${bwPaletteName}-0), 1);`,
'canvas-text-disabled': `hsla(var(--${bwPaletteName}-300), 1);`,
'canvas-text-hover': `hsla(var(--${palette}-600), 1);`,
'canvas-text-active': `hsla(var(--${palette}-700), 1);`,
};

if (weight === 'filled') {
if (weight === 'fill') {
colors['shape-default'] = `hsla(var(--${palette}-500), 1)`;
colors['shape-disabled'] = `hsla(var(--${palette}-200), 1)`;
colors['shape-hover'] = `hsla(var(--${palette}-600), 1)`;
colors['shape-active'] = `hsla(var(--${palette}-700), 1)`;

colors['shape-text-default'] = `hsla(var(--${bwPaletteName}-1000), 1)`;
colors['shape-text-hover'] = `hsla(var(--${bwPaletteName}-1000), 1)`;
colors['shape-text-active'] = `hsla(var(--${bwPaletteName}-1000), 1)`;

colors['canvas-hover'] = `hsla(var(--${palette}-600), 1)`;
colors['canvas-active'] = `hsla(var(--${palette}-700), 1)`;
colors['canvas-text-hover'] = `hsla(var(--${bwPaletteName}-0), 1)`;
colors['canvas-text-active'] = `hsla(var(--${bwPaletteName}-0), 1)`;
}

if (weight === 'none') {
colors['shape-disabled'] = `transparent`;
colors['shape-text-default'] = `hsla(var(--${palette}-500), 1)`;
colors['shape-text-hover'] = `hsla(var(--${palette}-600), 1)`;
colors['shape-text-active'] = `hsla(var(--${palette}-700), 1)`;
}

const priorityPalette = Object.keys(colors).map((key) => `--woly-${key}: ${colors[key]};`);

return css`
Expand Down
174 changes: 0 additions & 174 deletions src/woly/atoms/button/priorities.mdx

This file was deleted.

0 comments on commit 5a9f20d

Please sign in to comment.