yarn format
This commit is contained in:
parent
6b5eedd89c
commit
a55defcdfd
|
@ -4,44 +4,52 @@ import { Stack } from 'tamagui'
|
||||||
import { toggleButtonSelection } from '../../redux/Sidebars/slice'
|
import { toggleButtonSelection } from '../../redux/Sidebars/slice'
|
||||||
|
|
||||||
type IconButtonWithDotProps = {
|
type IconButtonWithDotProps = {
|
||||||
iconEl: any
|
iconEl: any
|
||||||
variant: 'ghost' | 'outline'
|
variant: 'ghost' | 'outline'
|
||||||
isDotOn: boolean
|
isDotOn: boolean
|
||||||
selected?: boolean
|
selected?: boolean
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
id: string
|
id: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const IconButtonWithDot = ({
|
const IconButtonWithDot = ({
|
||||||
iconEl,
|
iconEl,
|
||||||
variant,
|
variant,
|
||||||
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
|
||||||
{isDotOn && (
|
icon={iconEl}
|
||||||
<Stack
|
variant={variant}
|
||||||
style={{
|
selected={selected}
|
||||||
position: 'absolute',
|
disabled={disabled}
|
||||||
right: 7,
|
onPress={() => onClickHandler(id)}
|
||||||
top: 5,
|
/>
|
||||||
width: '9px',
|
{isDotOn && (
|
||||||
height: '9px',
|
<Stack
|
||||||
borderRadius: '50%',
|
style={{
|
||||||
backgroundColor: '#1992D7',
|
position: 'absolute',
|
||||||
border: '1.5px solid #fff',
|
right: 7,
|
||||||
}}
|
top: 5,
|
||||||
/>
|
width: '9px',
|
||||||
)}
|
height: '9px',
|
||||||
</Stack>
|
borderRadius: '50%',
|
||||||
)
|
backgroundColor: '#1992D7',
|
||||||
|
border: '1.5px solid #fff',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default IconButtonWithDot
|
export default IconButtonWithDot
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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}>
|
||||||
|
|
|
@ -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' },
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,26 @@
|
||||||
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
|
placeholder="Search Validators"
|
||||||
placeholder="Search Validators"
|
value={value}
|
||||||
value={value}
|
onChangeText={setValue}
|
||||||
onChangeText={setValue}
|
icon={<SearchIcon size={20} />}
|
||||||
icon={<SearchIcon size={20} />}
|
onClear={() => setValue('')}
|
||||||
onClear={() => setValue('')}
|
size={40}
|
||||||
size={40}
|
// button={{
|
||||||
// button={{
|
// label: 'Confirm',
|
||||||
// label: 'Confirm',
|
// onPress: () => alert('Confirmed!'),
|
||||||
// onPress: () => alert('Confirmed!'),
|
// }}
|
||||||
// }}
|
/>
|
||||||
/>
|
</>
|
||||||
</>
|
)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
export default InputSearch
|
export default InputSearch
|
||||||
|
|
|
@ -3,17 +3,23 @@ import type { Meta, StoryObj } from '@storybook/react'
|
||||||
import ValidatorListItem from './ValidatorListItem'
|
import ValidatorListItem from './ValidatorListItem'
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
title: 'Dashboard/ValidatorListItem',
|
title: 'Dashboard/ValidatorListItem',
|
||||||
component: ValidatorListItem,
|
component: ValidatorListItem,
|
||||||
parameters: {
|
parameters: {
|
||||||
layout: 'centered',
|
layout: 'centered',
|
||||||
},
|
},
|
||||||
tags: ['autodocs'],
|
tags: ['autodocs'],
|
||||||
} satisfies Meta<typeof ValidatorListItem>
|
} satisfies Meta<typeof ValidatorListItem>
|
||||||
|
|
||||||
export default meta
|
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,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,17 +3,17 @@ import type { Meta, StoryObj } from '@storybook/react'
|
||||||
import ValidatorsList from './ValidatorsList'
|
import ValidatorsList from './ValidatorsList'
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
title: 'Dashboard/ValidatorsList',
|
title: 'Dashboard/ValidatorsList',
|
||||||
component: ValidatorsList,
|
component: ValidatorsList,
|
||||||
parameters: {
|
parameters: {
|
||||||
layout: 'centered',
|
layout: 'centered',
|
||||||
},
|
},
|
||||||
tags: ['autodocs'],
|
tags: ['autodocs'],
|
||||||
} satisfies Meta<typeof ValidatorsList>
|
} satisfies Meta<typeof ValidatorsList>
|
||||||
|
|
||||||
export default meta
|
export default meta
|
||||||
type Story = StoryObj<typeof meta>
|
type Story = StoryObj<typeof meta>
|
||||||
|
|
||||||
export const Default: Story = {
|
export const Default: Story = {
|
||||||
args: {},
|
args: {},
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -15,7 +15,7 @@ const store = configureStore({
|
||||||
theme: themeReducer,
|
theme: themeReducer,
|
||||||
keyGeneration: keyGenerationReducer,
|
keyGeneration: keyGenerationReducer,
|
||||||
leftSidebar: leftSidebarReducer,
|
leftSidebar: leftSidebarReducer,
|
||||||
rightSidebar: rightSidebarReducer
|
rightSidebar: rightSidebarReducer,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue