-
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.
feat: add save graphstyle to localstorage
- Loading branch information
Расул
authored and
Расул
committed
Dec 9, 2023
1 parent
da5a424
commit 5832014
Showing
6 changed files
with
55 additions
and
34 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
src/components/SettingsModal/SettingsView/Appearance/index.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,44 @@ | ||
import { FC } from 'react' | ||
import styled from 'styled-components' | ||
import { GraphViewControl } from '~/components/App/ActionsToolbar/GraphViewControl' | ||
import { Button } from '~/components/Button' | ||
import { Flex } from '~/components/common/Flex' | ||
import { Text } from '~/components/common/Text' | ||
import { useDataStore } from '~/stores/useDataStore' | ||
|
||
type Props = { | ||
onClose: () => void | ||
} | ||
|
||
export const Appearance: FC<Props> = ({ onClose }) => { | ||
const [graphStyle] = useDataStore((s) => [s.graphStyle]) | ||
|
||
const handleSave = () => { | ||
localStorage.setItem('graphStyle', graphStyle) | ||
onClose() | ||
} | ||
|
||
return ( | ||
<Wrapper direction="column"> | ||
<StyledText>Default graph view:</StyledText> | ||
<GraphViewControl /> | ||
<Flex mt={308}> | ||
<Button kind="big" onClick={handleSave}> | ||
Save changes | ||
</Button> | ||
</Flex> | ||
</Wrapper> | ||
) | ||
} | ||
|
||
const Wrapper = styled(Flex)` | ||
display: flex; | ||
gap: 10px; | ||
padding: 36px; | ||
` | ||
|
||
const StyledText = styled(Text)` | ||
font-family: Barlow; | ||
font-size: 13px; | ||
font-weight: 400; | ||
` |
File renamed without changes.
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { BaseModal } from '~/components/Modal' | ||
import { useModal } from '~/stores/useModalStore' | ||
import { SourcesView } from './SourceView' | ||
import { SettingsView } from './SettingsView' | ||
|
||
export const SettingsModal = () => { | ||
const { close } = useModal('settings') | ||
|
||
return ( | ||
<BaseModal background="BG1" id="settings" noWrap onClose={close}> | ||
<SourcesView /> | ||
<SettingsView onClose={close} /> | ||
</BaseModal> | ||
) | ||
} |
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