Files
lucide/site/src/components/IconCustomizerDrawer.tsx
T
2ee208652f Add site categories (#876)
* bump package

* Add Logo

* remove console

* prettify it

* add favicons and fix issue

* Add categorie page

* add drag and drop

* Make drag and drop working

* Add drag options

* Add modal

* small styling fixes

* fix search

* Add code editor

* Add more styling

* Add more categories

* create context provider

* refactor eslint thing

* update chakra-ui

* improve, category bar

* Add sortly

* Add categories

* Try to fix new categories

* Fix Categories

* Add docs Menu Tree data

* Start with sectiontitles

* Create link list

* Add Docs menu to mobile

* Add some more pages and text

* Optimize text

* add license to the menu

* update packages

* Fix build

* Update title

* Remove ModifiedTooltip

* Fix assets

* add yarn to copy-assets command

* install deps

* update

* try something

* new categories page

* try something

* Add icons reorder

* add new icons page

* add category view button

* add categories

* Fix vercel build

* Add sidebar and costumize button

* fix merge conlfict

* Remove console.logs

* add sidebar

* Add icon overview

* Fix key render issue

* Fix types

* Fix category render

* Fix build

* update lockfile

* Added category icon and icon count in list. Moved scrollbar to the left to make it less intrusive

---------

Co-authored-by: Eric Fennis <eric.fennis@endurance.com>
Co-authored-by: Eric Fennis <eric@dreamteam.nl>
Co-authored-by: Karsa <karsa@karsa.org>
2023-04-09 16:49:11 +02:00

123 lines
3.2 KiB
TypeScript

import { useState } from 'react';
import { useCustomizeIconContext } from './CustomizeIconContext';
import { Edit } from 'lucide-react';
import {
Button,
Drawer,
DrawerBody,
DrawerCloseButton,
DrawerContent,
DrawerHeader,
FormControl,
FormLabel,
Grid,
Hide,
IconButton,
Show,
Slider,
SliderFilledTrack,
SliderThumb,
SliderTrack,
Flex,
Text,
ButtonProps,
} from '@chakra-ui/react';
import ColorPicker from './ColorPicker';
export const IconCustomizerDrawer = (props: ButtonProps) => {
const [showCustomize, setShowCustomize] = useState(false);
const {
color,
setColor,
size,
setSize,
strokeWidth,
setStroke,
resetStyle,
} = useCustomizeIconContext();
return (
<>
<Hide below='md'>
<Button
as="a"
leftIcon={<Edit />}
size="lg"
onClick={() => setShowCustomize(true)}
{...props}
>Customize</Button>
</Hide>
<Show below='md'>
<IconButton
aria-label='Customize'
variant="solid"
color="current"
onClick={() => setShowCustomize(true)}
icon={<Edit />}
{...props}
></IconButton>
</Show>
<Drawer isOpen={showCustomize} placement="right" onClose={() => setShowCustomize(false)} size="md">
<DrawerContent>
<DrawerCloseButton />
<DrawerHeader>Customize Icons</DrawerHeader>
<DrawerBody>
<Grid gridGap={'1em'}>
<FormControl>
<ColorPicker
color={color}
value={color}
onChangeComplete={col => setColor(col.hex)}
/>
</FormControl>
<FormControl>
<FormLabel htmlFor="stroke">
<Flex>
<Text flexGrow={1} fontWeight={'bold'}>
Stroke
</Text>
<Text>{strokeWidth}px</Text>
</Flex>
</FormLabel>
<Slider
value={strokeWidth}
onChange={setStroke}
min={0.5}
max={3}
step={0.5}
name={'stroke'}
>
<SliderTrack>
<SliderFilledTrack bg={color} />
</SliderTrack>
<SliderThumb />
</Slider>
</FormControl>
<FormControl>
<FormLabel htmlFor="size">
<Flex>
<Text flexGrow={1} fontWeight={'bold'}>
Size
</Text>
<Text>{size}px</Text>
</Flex>
</FormLabel>
<Slider value={size} onChange={setSize} min={12} max={64} step={1} name={'size'}>
<SliderTrack>
<SliderFilledTrack bg={color} />
</SliderTrack>
<SliderThumb />
</Slider>
</FormControl>
<FormControl>
<Button onClick={resetStyle}>Reset</Button>
</FormControl>
</Grid>
</DrawerBody>
</DrawerContent>
</Drawer>
</>
);
};