yarn format

This commit is contained in:
Hristo Nedelkov 2023-09-29 20:44:02 +03:00
parent 6b5eedd89c
commit a55defcdfd
10 changed files with 126 additions and 103 deletions

View File

@ -18,14 +18,22 @@ const IconButtonWithDot = ({
isDotOn, isDotOn,
selected, selected,
disabled, disabled,
id id,
}: IconButtonWithDotProps) => { }: IconButtonWithDotProps) => {
const dispatch = useDispatch() const dispatch = useDispatch()
const onClickHandler = (id: string) => { if (!disabled) dispatch(toggleButtonSelection(id)) } const onClickHandler = (id: string) => {
if (!disabled) dispatch(toggleButtonSelection(id))
}
return ( return (
<Stack style={{ position: 'relative', display: 'inline-block' }}> <Stack style={{ position: 'relative', display: 'inline-block' }}>
<IconButton icon={iconEl} variant={variant} selected={selected} disabled={disabled} onPress={() => onClickHandler(id)} /> <IconButton
icon={iconEl}
variant={variant}
selected={selected}
disabled={disabled}
onPress={() => onClickHandler(id)}
/>
{isDotOn && ( {isDotOn && (
<Stack <Stack
style={{ style={{

View File

@ -17,18 +17,27 @@ const LeftSidebar = () => {
const renderIcon = (id: string) => { const renderIcon = (id: string) => {
switch (id) { switch (id) {
case 'dashboard': return <DashboardIcon size={20} />; case 'dashboard':
case 'speed': return <SpeedIcon size={20} />; return <DashboardIcon size={20} />
case 'chart': return <ChartIcon size={20} />; case 'speed':
case 'heart': return <HeartIcon size={20} />; return <SpeedIcon size={20} />
case 'codeBlock': return <CodeBlockIcon size={20} />; case 'chart':
case 'communities': return <CommunitiesIcon size={20} />; return <ChartIcon size={20} />
case 'activityCenter': return <ActivityCenterIcon size={20} />; case 'heart':
case 'settings': return <SettingsIcon size={20} />; return <HeartIcon size={20} />
default: return null; case 'codeBlock':
return <CodeBlockIcon size={20} />
case 'communities':
return <CommunitiesIcon size={20} />
case 'activityCenter':
return <ActivityCenterIcon size={20} />
case 'settings':
return <SettingsIcon size={20} />
default:
return null
} }
}
}; return ( return (
<YStack <YStack
space={'$4'} space={'$4'}
minHeight={'100vh'} minHeight={'100vh'}
@ -44,7 +53,7 @@ const LeftSidebar = () => {
<IconButtonWithDot <IconButtonWithDot
key={button.id} key={button.id}
iconEl={renderIcon(button.id)} iconEl={renderIcon(button.id)}
variant={button.isDisabled ? "outline" : "ghost"} variant={button.isDisabled ? 'outline' : 'ghost'}
isDotOn={button.isDotOn} isDotOn={button.isDotOn}
selected={button.isSelected} selected={button.isSelected}
disabled={button.isDisabled} disabled={button.isDisabled}
@ -52,7 +61,7 @@ const LeftSidebar = () => {
/> />
))} ))}
</YStack> </YStack>
); )
} }
export default LeftSidebar export default LeftSidebar

View File

@ -48,8 +48,12 @@ const RightSidebar = () => {
<AddCard padding={'0 2vw'} /> <AddCard padding={'0 2vw'} />
</XStack> </XStack>
<XStack justifyContent={'space-between'} width={'85%'}> <XStack justifyContent={'space-between'} width={'85%'}>
<Text size={19} weight={'semibold'}>Validators</Text> <Text size={19} weight={'semibold'}>
<Text size={19} weight={'semibold'}>{countOfValidators}</Text> Validators
</Text>
<Text size={19} weight={'semibold'}>
{countOfValidators}
</Text>
</XStack> </XStack>
<Tabs defaultValue="active"> <Tabs defaultValue="active">
<Tabs.List size={32}> <Tabs.List size={32}>

View File

@ -15,5 +15,5 @@ export default meta
type Story = StoryObj<typeof meta> type Story = StoryObj<typeof meta>
export const Default: Story = { export const Default: Story = {
args: {value: 'Search value', }, args: { value: 'Search value' },
} }

View File

@ -1,12 +1,11 @@
import { Input } from "@status-im/components" import { Input } from '@status-im/components'
import { SearchIcon } from "@status-im/icons" import { SearchIcon } from '@status-im/icons'
type InputSearchProps = { type InputSearchProps = {
value: string value: string
setValue: (value: string) => void setValue: (value: string) => void
} }
const InputSearch = ({ value, setValue }: InputSearchProps) => { const InputSearch = ({ value, setValue }: InputSearchProps) => {
return ( return (
<> <>
<Input <Input

View File

@ -15,5 +15,11 @@ export default meta
type Story = StoryObj<typeof meta> type Story = StoryObj<typeof meta>
export const Default: Story = { export const Default: Story = {
args: { avatarKey: '37880sfsef38fsb', name: 'Validator 1', selected: true, isAvatarChipIncluded: true, isVerified: true }, args: {
avatarKey: '37880sfsef38fsb',
name: 'Validator 1',
selected: true,
isAvatarChipIncluded: true,
isVerified: true,
},
} }

View File

@ -5,7 +5,6 @@ import { useState, useEffect } from 'react'
import { useDispatch } from 'react-redux' import { useDispatch } from 'react-redux'
import { setCountOfValidators } from '../../../redux/RightSidebar/slice' import { setCountOfValidators } from '../../../redux/RightSidebar/slice'
const ValidatorsList = () => { const ValidatorsList = () => {
const dispatch = useDispatch() const dispatch = useDispatch()

View File

@ -1,25 +1,23 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit'; import { createSlice, PayloadAction } from '@reduxjs/toolkit'
type RightSidebarStateType = { type RightSidebarStateType = {
countOfValidators: number; countOfValidators: number
}; }
const initialState: RightSidebarStateType = { const initialState: RightSidebarStateType = {
countOfValidators: 0, countOfValidators: 0,
}; }
const rightSidebarSlice = createSlice({ const rightSidebarSlice = createSlice({
name: 'rightSidebar', name: 'rightSidebar',
initialState, initialState,
reducers: { reducers: {
setCountOfValidators: (state, action: PayloadAction<number>) => { setCountOfValidators: (state, action: PayloadAction<number>) => {
state.countOfValidators = action.payload; state.countOfValidators = action.payload
}, },
}, },
}); })
export const { export const { setCountOfValidators } = rightSidebarSlice.actions
setCountOfValidators,
} = rightSidebarSlice.actions;
export default rightSidebarSlice.reducer; export default rightSidebarSlice.reducer

View File

@ -15,7 +15,7 @@ const store = configureStore({
theme: themeReducer, theme: themeReducer,
keyGeneration: keyGenerationReducer, keyGeneration: keyGenerationReducer,
leftSidebar: leftSidebarReducer, leftSidebar: leftSidebarReducer,
rightSidebar: rightSidebarReducer rightSidebar: rightSidebarReducer,
}, },
}) })