From eff07f7cac7af28388f13d273a7eb008e60381bf Mon Sep 17 00:00:00 2001 From: Peiman Date: Fri, 10 Jun 2022 15:09:13 +0430 Subject: [PATCH 1/2] feat: improve Badge styles and Dialog --- src/components/Badge/Badge.tsx | 19 ++++++++++++++----- src/components/Dialog/Dialog.tsx | 2 +- src/components/TextField/TextField.tsx | 8 +++++++- src/styles/_typography.scss | 6 ++++++ src/styles/_variables.scss | 3 +++ 5 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/components/Badge/Badge.tsx b/src/components/Badge/Badge.tsx index 2cfa2fced..9691f18fc 100644 --- a/src/components/Badge/Badge.tsx +++ b/src/components/Badge/Badge.tsx @@ -1,7 +1,7 @@ import clsx from 'clsx'; import { HTMLAttributes, ReactNode } from 'react'; -export type BadgeVariant = 'success'; +export type BadgeVariant = 'success' | 'blue' | 'pink' | 'pink' | 'orange' | 'red' | 'yellow'; export interface BadgeProps extends HTMLAttributes { variant?: BadgeVariant; @@ -11,21 +11,30 @@ export interface BadgeProps extends HTMLAttributes { } const badgeColors = { - success: 'ui-border ui-border-green ui-bg-green ui-text-green ui-text-xs' + success: 'ui-border-green ui-bg-green ui-text-green', + blue: 'ui-border-blue ui-bg-blue ui-text-blue', + pink: 'ui-border-pink ui-bg-pink ui-text-pink', + orange: 'ui-border-orange ui-bg-orange ui-text-orange', + red: 'ui-border-red ui-bg-red ui-text-red', + yellow: 'ui-border-yellow ui-bg-yellow ui-text-yellow' }; export const Badge: React.FC = ({ className, - defaultClass = 'ui-text-xs ui-font-semibold ui-px-2.5 ui-py-0.5', + defaultClass = 'ui-tg-caption-sm ui-font-semibold ui-px-2.5 ui-py-0.5', variant = 'sucess', children, ...props }) => { return ( - + {children} diff --git a/src/components/Dialog/Dialog.tsx b/src/components/Dialog/Dialog.tsx index 9c0445227..c29ccb74f 100644 --- a/src/components/Dialog/Dialog.tsx +++ b/src/components/Dialog/Dialog.tsx @@ -51,7 +51,7 @@ export const Dialog: React.FC = ({ void; wrapperClassName?: string; inputSize?: InputSize; + variant?: TextFieldVariant; } interface InputProps extends InputHTMLAttributes, BaseProps { @@ -30,6 +33,7 @@ export const TextField: React.FC = ({ onLabelClick, wrapperClassName, inputSize = 'md', + variant = 'default', ...props }) => { const hasError = !!error; @@ -40,8 +44,10 @@ export const TextField: React.FC = ({ 'ui-h-14 ui-px-6': !multiline && inputSize === 'md', 'ui-h-10 ui-px-3': !multiline && inputSize === 'sm', 'ui-cursor-not-allowed': props.disabled, - 'focus:ui-border-primary focus:dark:ui-border-primary active:dark:ui-border-primary ui-bg-gray-50 dark:ui-bg-dark-blue': + 'focus:ui-border-primary focus:dark:ui-border-primary active:dark:ui-border-primary': !props.disabled, + 'ui-bg-gray-50 dark:ui-bg-dark-blue': variant === 'default' && !props.disabled, + 'ui-bg-black': variant === 'black' && !props.disabled, 'ui-border-black-200 dark:ui-border-black-400': !hasError, 'ui-border-red-400 dark:ui-border-red-400 focus:ui-border-red-400 ui-text-red-400 dark:ui-text-red-400': hasError diff --git a/src/styles/_typography.scss b/src/styles/_typography.scss index 119178e04..ed3d8f077 100644 --- a/src/styles/_typography.scss +++ b/src/styles/_typography.scss @@ -88,4 +88,10 @@ line-height: 1rem; // 16px font-weight: 600; } + + .ui-tg-caption-sm { + font-size: 0.6rem; // 9.6px + line-height: 0.8rem; // 12.8px + font-weight: normal; + } } diff --git a/src/styles/_variables.scss b/src/styles/_variables.scss index ab5172d34..2067020ee 100644 --- a/src/styles/_variables.scss +++ b/src/styles/_variables.scss @@ -164,6 +164,9 @@ html { .ui-darker-60 { background-color: rgba(0, 0, 0, 0.6); } +.ui-darker-70 { + background-color: rgba(0, 0, 0, 0.7); +} .ui-darker-80 { background-color: rgba(0, 0, 0, 0.8); } From 540b3af5baa0f4b450bb8fe160c4ab7bcf0222d7 Mon Sep 17 00:00:00 2001 From: Peiman Date: Fri, 10 Jun 2022 15:12:31 +0430 Subject: [PATCH 2/2] fix: fix badge darken style --- src/components/Badge/Badge.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Badge/Badge.tsx b/src/components/Badge/Badge.tsx index 9691f18fc..d800bc62f 100644 --- a/src/components/Badge/Badge.tsx +++ b/src/components/Badge/Badge.tsx @@ -34,7 +34,7 @@ export const Badge: React.FC = ({ badgeColors[variant as BadgeVariant] )} > - + {children}