-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* style: labels on added time * style: remove mentions of PiP * refactor: unify usage of ms for timers * refactor: create events with 0 duration * style: several small tweaks * refactor: keep block when applying delays * feat: blocks have titles * style: improvements in time entry warnings * style: override progress bar styles * style: prevent overflow * feat: show character count in editor * refactor: provide initial payload * refactor: lower test boundary * refactor: get colour from swatches * style: rename title block * chore: version bump
- Loading branch information
Showing
57 changed files
with
556 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
apps/client/src/common/components/input/colour-input/ColourInput.module.scss
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
apps/client/src/common/components/input/colour-input/ColourInput.tsx
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
apps/client/src/common/components/input/colour-input/Swatch.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { IoBan } from '@react-icons/all-files/io5/IoBan'; | ||
|
||
import { cx } from '../../../utils/styleUtils'; | ||
|
||
import style from './SwatchSelect.module.scss'; | ||
|
||
interface SwatchProps { | ||
color: string; | ||
onClick: (color: string) => void; | ||
isSelected?: boolean; | ||
} | ||
|
||
export default function Swatch(props: SwatchProps) { | ||
const { color, isSelected, onClick } = props; | ||
|
||
const classes = cx([style.swatch, isSelected ? style.selected : null]); | ||
|
||
if (!color) { | ||
return ( | ||
<div className={`${classes} ${style.center}`}> | ||
<IoBan /> | ||
</div> | ||
); | ||
} | ||
return <div className={classes} style={{ backgroundColor: `${color}` }} onClick={() => onClick(color)} />; | ||
} |
24 changes: 24 additions & 0 deletions
24
apps/client/src/common/components/input/colour-input/SwatchSelect.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
.list { | ||
display: flex; | ||
gap: 4px; | ||
} | ||
|
||
.swatch { | ||
cursor: pointer; | ||
aspect-ratio: 1; | ||
width: 2rem; | ||
height: 2rem; | ||
border-radius: 16px; | ||
border: 4px solid #262626; | ||
|
||
&.selected { | ||
border: 2px solid #578AF4; | ||
} | ||
} | ||
|
||
.center { | ||
display: grid; | ||
place-content: center; | ||
color: #578AF4; | ||
} |
50 changes: 50 additions & 0 deletions
50
apps/client/src/common/components/input/colour-input/SwatchSelect.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { useCallback } from 'react'; | ||
|
||
import { EventEditorSubmitActions } from '../../../../features/event-editor/EventEditor'; | ||
|
||
import Swatch from './Swatch'; | ||
|
||
import style from './SwatchSelect.module.scss'; | ||
|
||
interface ColourInputProps { | ||
value: string; | ||
name: EventEditorSubmitActions; | ||
handleChange: (newValue: EventEditorSubmitActions, name: string) => void; | ||
} | ||
|
||
const colours = [ | ||
'', | ||
'#FFCC78', // $orange-400 | ||
'#FFAB33', // $orange-600 | ||
'#77C785', // $green-400 | ||
'#339E4E', // $green-600 | ||
'#779BE7', // $blue-400 | ||
'#3E75E8', // $blue-600 | ||
'#FF7878', // $red-400 | ||
'#ED3333', // $red-600 | ||
'#A790F5', // $violet-400 | ||
'#8064E1', // $violet-600 | ||
'#9d9d9d', // $gray-500 | ||
'#ececec', // $gray-100 | ||
]; | ||
|
||
export default function SwatchSelect(props: ColourInputProps) { | ||
const { value, name, handleChange } = props; | ||
|
||
const setColour = useCallback( | ||
(newValue: string) => { | ||
if (newValue !== value) { | ||
handleChange(name, newValue); | ||
} | ||
}, | ||
[handleChange, name, value], | ||
); | ||
|
||
return ( | ||
<div className={style.list}> | ||
{colours.map((colour) => ( | ||
<Swatch key={colour} color={colour} onClick={setColour} isSelected={value === colour} /> | ||
))} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.