Skip to content

Commit

Permalink
Merge pull request #2084 from MahtabBukhari/Setting-modal-Appearance-…
Browse files Browse the repository at this point in the history
…tab-should-be-according-to-Figma

Setting modal Appearance tab should be according to Figma
  • Loading branch information
Rassl authored Aug 26, 2024
2 parents 80d8551 + a960cfa commit ff6f609
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 5 deletions.
11 changes: 8 additions & 3 deletions src/components/App/ActionsToolbar/GraphViewControl/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ const Wrapper = styled(Flex).attrs({
align: 'center',
justify: 'space-between',
})`
padding: 6px 6px 6px 11px;
background: ${colors.BG1};
border-radius: 200px;
width: 447px;
height: 48px;
background: ${colors.appearanceBg};
border-radius: 6px;
.icon {
color: ${colors.GRAY6};
font-size: 20px;
cursor: pointer;
padding: 12px 20px;
&:hover {
color: ${colors.GRAY3};
Expand All @@ -65,6 +67,9 @@ const Wrapper = styled(Flex).attrs({
&.active {
color: ${colors.white};
background: ${colors.primaryBlue};
padding: 12px 20px;
border-radius: 6px;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/App/ActionsToolbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useAppStore } from '~/stores/useAppStore'
import { useDataStore } from '~/stores/useDataStore'
import { useSelectedNode } from '~/stores/useGraphStore'
import { CameraRecenterControl } from './CameraRecenterControl'
import { GraphViewControl } from './GraphViewControl'
import { GraphViewControl } from '~/components/common/GraphViewControl'
import { PlayerControl } from './PlayerControl'

export const ActionsToolbar = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export const Appearance: FC<Props> = ({ onClose }) => {
<Wrapper direction="column">
<StyledText>Default graph view:</StyledText>
<GraphViewControl />
<Flex mt={308} py={24}>

<Flex mt={308} py={8}>
<Button
color="secondary"
disabled={loading}
Expand Down Expand Up @@ -61,6 +62,7 @@ const StyledText = styled(Text)`
font-family: Barlow;
font-size: 13px;
font-weight: 400;
color: ${colors.lightGray};
`

const IconWrapper = styled.span`
Expand Down
74 changes: 74 additions & 0 deletions src/components/common/GraphViewControl/index.tsx
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;
}
`
1 change: 1 addition & 0 deletions src/utils/colors/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const colors = {
black: 'rgb(0, 0, 0)',
appearanceBg: 'rgba(60, 64, 83, 0.3)',
disableBtn: 'rgba(35, 37, 47, 0.8)',
bluePressState: 'rgb(57, 97, 220)',
blueTextAccent: 'rgb(130, 180, 255)',
Expand Down

0 comments on commit ff6f609

Please sign in to comment.