-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2084 from MahtabBukhari/Setting-modal-Appearance-…
…tab-should-be-according-to-Figma Setting modal Appearance tab should be according to Figma
- Loading branch information
Showing
5 changed files
with
87 additions
and
5 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import clsx from 'clsx' | ||
import { ReactElement } from 'react' | ||
import styled from 'styled-components' | ||
import { useShallow } from 'zustand/react/shallow' | ||
import BubbleChartIcon from '~/components/Icons/BubbleChartIcon' | ||
import CommunitiesIcon from '~/components/Icons/CommunitiesIcon' | ||
import GrainIcon from '~/components/Icons/GrainIcon' | ||
import PublicIcon from '~/components/Icons/PublicIcon' | ||
import { Flex } from '~/components/common/Flex' | ||
import { GraphStyle, graphStyles, useGraphStore } from '~/stores/useGraphStore' | ||
import { colors } from '~/utils/colors' | ||
|
||
interface IconsMapper { | ||
split: ReactElement | ||
force: ReactElement | ||
sphere: ReactElement | ||
earth: ReactElement | ||
} | ||
|
||
const IconsMapper = { | ||
split: <GrainIcon />, | ||
force: <CommunitiesIcon />, | ||
sphere: <BubbleChartIcon />, | ||
earth: <PublicIcon />, | ||
} | ||
|
||
export const GraphViewControl = () => { | ||
const [graphStyle, setGraphStyle] = useGraphStore(useShallow((s) => [s.graphStyle, s.setGraphStyle])) | ||
|
||
const changeGraphType = (val: GraphStyle) => { | ||
setGraphStyle(val) | ||
} | ||
|
||
return ( | ||
<Wrapper direction="column"> | ||
{graphStyles.map((i) => ( | ||
<Flex key={i} className={clsx('icon', { active: graphStyle === i })} onClick={() => changeGraphType(i)}> | ||
{IconsMapper[i]} | ||
</Flex> | ||
))} | ||
</Wrapper> | ||
) | ||
} | ||
|
||
const Wrapper = styled(Flex).attrs({ | ||
direction: 'row', | ||
align: 'center', | ||
justify: 'space-between', | ||
})` | ||
padding: 6px 6px 6px 11px; | ||
background: ${colors.BG1}; | ||
border-radius: 200px; | ||
.icon { | ||
color: ${colors.GRAY6}; | ||
font-size: 20px; | ||
cursor: pointer; | ||
&:hover { | ||
color: ${colors.GRAY3}; | ||
} | ||
&:active { | ||
color: ${colors.white}; | ||
} | ||
&.active { | ||
color: ${colors.white}; | ||
} | ||
} | ||
.icon + .icon { | ||
margin-left: 20px; | ||
} | ||
` |
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