-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(extension-chrome): design system refactor
- Loading branch information
Showing
13 changed files
with
247 additions
and
182 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
packages/extension-chrome/src/pages/Components/ProgressLine.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,31 @@ | ||
import { Box, BoxProps, HStack } from '@chakra-ui/react'; | ||
import range from 'lodash.range'; | ||
import React, { FC } from 'react'; | ||
|
||
export type ProgressIndicatorProps = { total: number; current: number } & BoxProps; | ||
|
||
export const ProcessIndicator: FC<ProgressIndicatorProps> = ({ total, current }) => { | ||
const getIndicatorColor = (index: number) => { | ||
if (index < current) { | ||
return 'primary.lighter'; | ||
} else if (index > current) { | ||
return 'gray.300'; | ||
} | ||
return 'primary'; | ||
}; | ||
return ( | ||
<HStack spacing="12px" paddingY="4px" mb="48px"> | ||
{range(0, total).map((index) => ( | ||
<Box | ||
transitionProperty="background" | ||
transitionDuration="common" | ||
key={index} | ||
w="66px" | ||
h="5px" | ||
borderRadius="5px" | ||
backgroundColor={getIndicatorColor(index)} | ||
/> | ||
))} | ||
</HStack> | ||
); | ||
}; |
56 changes: 56 additions & 0 deletions
56
packages/extension-chrome/src/pages/Components/ProgressSteps.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,56 @@ | ||
import { CheckCircleIcon } from '@chakra-ui/icons'; | ||
import { Box, BoxProps, Grid, Icon, Text } from '@chakra-ui/react'; | ||
import Steps from 'rc-steps'; | ||
import { StepsProps } from 'rc-steps/lib/Steps'; | ||
import React, { FC } from 'react'; | ||
import StepProcessingIcon from './icons/StepProcessing.svg'; | ||
import StepWaitingIcon from './icons/StepWaiting.svg'; | ||
|
||
export type ProgressStepsProps = Pick<StepsProps, 'items' | 'current'> & BoxProps; | ||
const renderSingleStep: StepsProps['itemRender'] = ({ title, description, status }) => { | ||
const icon = { | ||
wait: <Icon as={StepWaitingIcon} w="24px" h="24px" />, | ||
process: <Icon as={StepProcessingIcon} w="24px" h="24px" />, | ||
finish: <CheckCircleIcon w="20px" h="20px" color="white" />, | ||
error: <></>, | ||
}[status ?? 'wait']; | ||
return ( | ||
<Grid | ||
sx={{ | ||
'&:last-child .rc-steps-item-tail': { | ||
height: 0, | ||
width: 0, | ||
border: 'none', | ||
}, | ||
}} | ||
opacity={status === 'wait' ? 0.7 : 1} | ||
color="white" | ||
templateRows="auto" | ||
templateColumns="24px auto" | ||
> | ||
<Box alignSelf="center" justifySelf="center"> | ||
{icon} | ||
</Box> | ||
<Text as={Box} ml="4px" alignSelf="center" fontWeight="semibold" fontSize="md"> | ||
{title} | ||
</Text> | ||
<Box | ||
className="rc-steps-item-tail" | ||
w="0" | ||
alignSelf="center" | ||
justifySelf="center" | ||
h="43px" | ||
border="1px solid white" | ||
borderRadius="2px" | ||
my="1px" | ||
/> | ||
<Text as={Box} lineHeight="4" ml="8px" fontSize="sm"> | ||
{description} | ||
</Text> | ||
</Grid> | ||
); | ||
}; | ||
|
||
export const ProgressSteps: FC<ProgressStepsProps> = (props) => { | ||
return <Box as={Steps} direction="vertical" itemRender={renderSingleStep} {...props} />; | ||
}; |
36 changes: 36 additions & 0 deletions
36
packages/extension-chrome/src/pages/Components/SearchBar.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,36 @@ | ||
import { SearchIcon } from '@chakra-ui/icons'; | ||
import { Center, Input, InputGroup, InputGroupProps, InputLeftElement, InputProps } from '@chakra-ui/react'; | ||
import React, { FC } from 'react'; | ||
|
||
type InputPickedFields = 'onChange' | 'onBlur' | 'onFocus' | 'onClick' | 'value' | 'defaultValue'; | ||
|
||
type SearchBarProps = Omit<InputGroupProps, InputPickedFields> & Pick<InputProps, InputPickedFields>; | ||
|
||
export const SearchBar: FC<SearchBarProps> = ({ onChange, onBlur, onFocus, onClick, value, defaultValue, ...rest }) => ( | ||
<InputGroup w="100%" {...rest}> | ||
<InputLeftElement h="100%" px="8px" w="60px"> | ||
<Center w="40px" h="40px" bg="white.300" borderRadius="8px"> | ||
<SearchIcon w="24px" h="24px" /> | ||
</Center> | ||
</InputLeftElement> | ||
<Input | ||
h="60px" | ||
fontSize="16px" | ||
type="search" | ||
background="transparent" | ||
border="1px solid" | ||
borderColor="white.300" | ||
color="white" | ||
pl="60px" | ||
lineHeight="24px" | ||
_hover={{ borderColor: 'white.700' }} | ||
_focusVisible={{ borderColor: 'accent', borderWidth: '2px !important' }} | ||
onChange={onChange} | ||
onBlur={onBlur} | ||
onFocus={onFocus} | ||
onClick={onClick} | ||
value={value} | ||
defaultValue={defaultValue} | ||
/> | ||
</InputGroup> | ||
); |
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.