Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
802 changes: 449 additions & 353 deletions packages/core/lib/colors/color.ts

Large diffs are not rendered by default.

223 changes: 0 additions & 223 deletions packages/core/lib/colors/color.type.ts

This file was deleted.

43 changes: 14 additions & 29 deletions packages/core/lib/components/Badge.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { Label } from './Label';
import { Color } from '../colors/color.type';

export type BadgeProps = {
label: string;
Expand All @@ -13,41 +12,29 @@ export type BadgeProps = {
const variantStyles: Record<
NonNullable<BadgeProps['variant']>,
{
fill: { style: string; color: Color };
stroke: { style: string; color: Color };
fill: { style: string };
stroke: { style: string };
}
> = {
default: {
fill: { style: 'bg-gray-10', color: 'gray-70' },
stroke: { style: 'bg-transparent border border-gray-30', color: 'gray-70' },
fill: { style: 'bg-gray-10' },
stroke: { style: 'bg-transparent border border-gray-30' },
},
primary: {
fill: { style: 'bg-primary-10', color: 'primary-70' },
stroke: {
style: 'bg-transparent border border-primary-30',
color: 'primary-70',
},
fill: { style: 'bg-primary-10' },
stroke: { style: 'bg-transparent border border-primary-30' },
},
success: {
fill: { style: 'bg-success-10', color: 'success-70' },
stroke: {
style: 'bg-transparent border border-success-30',
color: 'success-70',
},
fill: { style: 'bg-success-10' },
stroke: { style: 'bg-transparent border border-success-30' },
},
warning: {
fill: { style: 'bg-warning-10', color: 'warning-70' },
stroke: {
style: 'bg-transparent border border-warning-30',
color: 'warning-70',
},
fill: { style: 'bg-warning-10' },
stroke: { style: 'bg-transparent border border-warning-30' },
},
danger: {
fill: { style: 'bg-danger-10', color: 'danger-70' },
stroke: {
style: 'bg-transparent border border-danger-30',
color: 'danger-70',
},
fill: { style: 'bg-danger-10' },
stroke: { style: 'bg-transparent border border-danger-30' },
},
};

Expand All @@ -71,17 +58,15 @@ export const Badge: React.FC<BadgeProps> = ({
const variantStyle = variantStyles[variant][appearance];
const { padding, fontSize } = sizeStyles[size];

const { style, color } = variantStyle;
const { style } = variantStyle;

return (
<span
className={`inline-flex items-center justify-center rounded-2 ${style} ${padding} ${className}`}
role="status"
aria-label={label}
>
<Label color={color} size={fontSize}>
{label}
</Label>
<Label size={fontSize}>{label}</Label>
</span>
);
};
5 changes: 1 addition & 4 deletions packages/core/lib/components/Body.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { Color, getTextColorClassname } from '../colors/color.type';

export type BodyProps<E extends React.ElementType> = {
size?: 'l' | 'm' | 's';
weight?: 'regular' | 'bold';
color?: Color;
children: React.ReactNode;
className?: string;
} & React.ComponentPropsWithoutRef<E>;
Expand All @@ -26,7 +23,7 @@ export const Body = <E extends React.ElementType = 'p'>({
regular: 'font-regular',
bold: 'font-bold',
}[weight];
const textColorClass = getTextColorClassname(color);
const textColorClass = '';

return (
<p
Expand Down
17 changes: 1 addition & 16 deletions packages/core/lib/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { Label } from './Label';
import { Color } from '../colors/color.type';

export type ButtonProps<E extends React.ElementType> = {
variant?: 'primary' | 'secondary' | 'tertiary' | 'text';
Expand All @@ -23,33 +22,23 @@ export const Button = <E extends React.ElementType = 'button'>({

const variantStyles: {
style: string;
color: Color;
disabledStyle: string;
disabledColor: Color;
} = {
primary: {
style: 'bg-primary hover:bg-primary-60',
color: 'gray-0' as Color,
disabledStyle: 'bg-primary-20',
disabledColor: 'gray-0' as Color,
},
secondary: {
style: 'bg-gray-0 hover:bg-primary-5 border border-primary',
color: 'primary' as Color,
disabledStyle: 'bg-gray-0 border border-primary-30',
disabledColor: 'primary-30' as Color,
},
tertiary: {
style: 'bg-gray-0 hover:bg-gray-5 border border-gray-90',
color: 'gray-90' as Color,
disabledStyle: 'bg-gray-0 border border-gray-40',
disabledColor: 'gray-40' as Color,
},
text: {
style: 'bg-transparent',
color: 'gray-90' as Color,
disabledStyle: 'bg-transparent',
disabledColor: 'gray-40' as Color,
},
}[variant];

Expand Down Expand Up @@ -105,11 +94,7 @@ export const Button = <E extends React.ElementType = 'button'>({
disabled={disabled}
{...props}
>
<Label
color={disabled ? variantStyles.disabledColor : variantStyles.color}
size={sizeStyles.fontSize}
className={labelStyles}
>
<Label size={sizeStyles.fontSize} className={labelStyles}>
{children}
</Label>
</button>
Expand Down
Loading