refactor: extract button styles

This commit is contained in:
Carlos Valente
2025-06-24 16:56:52 +02:00
committed by Carlos Valente
parent c603f29197
commit 4c08482258
4 changed files with 14 additions and 31 deletions
@@ -22,6 +22,11 @@
} }
} }
.small {
height: 1.5rem;
font-size: calc(1rem - 3px);
}
.medium { .medium {
height: 2rem; height: 2rem;
font-size: calc(1rem - 2px); font-size: calc(1rem - 2px);
@@ -40,3 +45,4 @@
.fluid { .fluid {
width: 100%; width: 100%;
} }
@@ -6,7 +6,7 @@ import style from './Button.module.scss';
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> { interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
variant?: 'primary' | 'subtle' | 'subtle-white' | 'destructive' | 'subtle-destructive'; variant?: 'primary' | 'subtle' | 'subtle-white' | 'destructive' | 'subtle-destructive';
size?: 'medium' | 'large' | 'xlarge'; size?: 'small' | 'medium' | 'large' | 'xlarge';
fluid?: boolean; fluid?: boolean;
} }
@@ -4,11 +4,6 @@
gap: 1rem; gap: 1rem;
padding-block: 0.5rem; padding-block: 0.5rem;
font-size: calc(1rem - 3px);
padding-left: calc(2em + 0.5rem); padding-left: calc(2em + 0.5rem);
background-color: color-mix(in srgb, var(--user-bg, transparent) 10%, transparent 90%); background-color: color-mix(in srgb, var(--user-bg, transparent) 10%, transparent 90%);
} }
.quickBtn {
font-weight: 400;
}
@@ -1,8 +1,8 @@
import { memo, useRef } from 'react'; import { memo, useRef } from 'react';
import { IoAdd } from 'react-icons/io5'; import { IoAdd } from 'react-icons/io5';
import { Button } from '@chakra-ui/react';
import { MaybeString, SupportedEntry } from 'ontime-types'; import { MaybeString, SupportedEntry } from 'ontime-types';
import Button from '../../../common/components/buttons/Button';
import { useEntryActions } from '../../../common/hooks/useEntryAction'; import { useEntryActions } from '../../../common/hooks/useEntryAction';
import style from './QuickAddBlock.module.scss'; import style from './QuickAddBlock.module.scss';
@@ -67,35 +67,17 @@ function QuickAddBlock(props: QuickAddBlockProps) {
return ( return (
<div className={style.quickAdd} style={blockColour ? { '--user-bg': blockColour } : {}}> <div className={style.quickAdd} style={blockColour ? { '--user-bg': blockColour } : {}}>
<Button <Button onClick={addEvent} size='small' variant='subtle-white'>
onClick={addEvent} <IoAdd />
size='xs'
variant='ontime-subtle-white'
className={style.quickBtn}
leftIcon={<IoAdd />}
color='#b1b1b1' // $gray-400
>
Event Event
</Button> </Button>
<Button <Button onClick={addDelay} size='small' variant='subtle-white'>
onClick={addDelay} <IoAdd />
size='xs'
variant='ontime-subtle-white'
className={style.quickBtn}
leftIcon={<IoAdd />}
color='#b1b1b1' // $gray-400
>
Delay Delay
</Button> </Button>
{parentBlock === null && ( {parentBlock === null && (
<Button <Button onClick={addBlock} size='small' variant='subtle-white'>
onClick={addBlock} <IoAdd />
size='xs'
variant='ontime-subtle-white'
className={style.quickBtn}
leftIcon={<IoAdd />}
color='#b1b1b1' // $gray-400
>
Block Block
</Button> </Button>
)} )}