Settings page setup
This commit is contained in:
parent
5ec9a651e1
commit
01269e8b76
5 changed files with 77 additions and 8 deletions
|
|
@ -1,13 +1,14 @@
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import { ThemeProvider, Flex, Box, Text } from 'theme-ui'
|
import { ThemeProvider, Flex, Box, Text } from 'theme-ui'
|
||||||
import { theme } from '../../theme'
|
import { theme } from '../../theme'
|
||||||
import { MapPin, Globe, ExternalLink } from 'react-feather'
|
import { MapPin, Globe, Settings, ExternalLink } from 'react-feather'
|
||||||
import TabItem from './TabItem'
|
import TabItem from './TabItem'
|
||||||
import LocationPage from './LocationPage'
|
import LocationPage from './LocationPage'
|
||||||
import UserAgentPage from './UserAgentPage'
|
import UserAgentPage from './UserAgentPage'
|
||||||
|
import SettingsPage from './SettingsPage'
|
||||||
|
|
||||||
const Popup = () => {
|
const Popup = () => {
|
||||||
const [tab, setTab] = useState('location')
|
const [tab, setTab] = useState('settings')
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ThemeProvider theme={theme}>
|
<ThemeProvider theme={theme}>
|
||||||
|
|
@ -35,6 +36,11 @@ const Popup = () => {
|
||||||
active={tab === 'useragent'}
|
active={tab === 'useragent'}
|
||||||
onClick={() => setTab('useragent')}
|
onClick={() => setTab('useragent')}
|
||||||
/>
|
/>
|
||||||
|
<TabItem
|
||||||
|
Icon={Settings}
|
||||||
|
active={tab === 'settings'}
|
||||||
|
onClick={() => setTab('settings')}
|
||||||
|
/>
|
||||||
<TabItem
|
<TabItem
|
||||||
Icon={ExternalLink}
|
Icon={ExternalLink}
|
||||||
onClick={() => window.open('https://vytal.io')}
|
onClick={() => window.open('https://vytal.io')}
|
||||||
|
|
@ -43,6 +49,7 @@ const Popup = () => {
|
||||||
<Box sx={{ m: '12px', width: '100%' }}>
|
<Box sx={{ m: '12px', width: '100%' }}>
|
||||||
<LocationPage tab={tab} />
|
<LocationPage tab={tab} />
|
||||||
<UserAgentPage tab={tab} />
|
<UserAgentPage tab={tab} />
|
||||||
|
<SettingsPage tab={tab} />
|
||||||
<Text
|
<Text
|
||||||
sx={{
|
sx={{
|
||||||
mb: '8px',
|
mb: '8px',
|
||||||
|
|
|
||||||
16
src/pages/Popup/SettingsCheckBox.tsx
Normal file
16
src/pages/Popup/SettingsCheckBox.tsx
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { Label, Checkbox } from 'theme-ui'
|
||||||
|
|
||||||
|
interface LocationPageProps {
|
||||||
|
title: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const SettingsCheckBox = ({ title }: LocationPageProps) => {
|
||||||
|
return (
|
||||||
|
<Label sx={{ mb: '8px' }}>
|
||||||
|
<Checkbox defaultChecked={true} />
|
||||||
|
{title}
|
||||||
|
</Label>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SettingsCheckBox
|
||||||
47
src/pages/Popup/SettingsPage.tsx
Normal file
47
src/pages/Popup/SettingsPage.tsx
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
import { useState, useEffect } from 'react'
|
||||||
|
import { Box, Label, Checkbox, Select } from 'theme-ui'
|
||||||
|
import SettingsCheckBox from './SettingsCheckBox'
|
||||||
|
|
||||||
|
interface LocationPageProps {
|
||||||
|
tab: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const SettingsPage = ({ tab }: LocationPageProps) => {
|
||||||
|
const [ip, setIP] = useState(null)
|
||||||
|
|
||||||
|
useEffect(() => {}, [])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: tab === 'settings' ? 'block' : 'none',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Box sx={{ fontSize: '20px', mb: '12px' }}>Settings</Box>
|
||||||
|
<SettingsCheckBox title={'Block WebRTC'} />
|
||||||
|
<SettingsCheckBox title={'Block Address Autofill Address'} />
|
||||||
|
<SettingsCheckBox title={'Dark Mode'} />
|
||||||
|
<Label htmlFor="configuration">Language</Label>
|
||||||
|
<Select
|
||||||
|
name="Language"
|
||||||
|
id="Language"
|
||||||
|
// value={configuration}
|
||||||
|
// onChange={changeConfiguration}
|
||||||
|
>
|
||||||
|
<option>English</option>
|
||||||
|
<option>French</option>
|
||||||
|
<option>Chinese</option>
|
||||||
|
<option>Russian</option>
|
||||||
|
<option>Farsi</option>
|
||||||
|
|
||||||
|
{/* {Object.keys(configurations).map((key) => (
|
||||||
|
<option value={key} key={key}>
|
||||||
|
{configurations[key].name}
|
||||||
|
</option>
|
||||||
|
))} */}
|
||||||
|
</Select>
|
||||||
|
</Box>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SettingsPage
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import { Button } from 'theme-ui'
|
||||||
interface IconProps {
|
interface IconProps {
|
||||||
Icon: React.ElementType
|
Icon: React.ElementType
|
||||||
active?: boolean
|
active?: boolean
|
||||||
|
|
@ -8,7 +8,7 @@ interface IconProps {
|
||||||
|
|
||||||
const TabItem = ({ Icon, onClick, active }: IconProps) => {
|
const TabItem = ({ Icon, onClick, active }: IconProps) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<Button
|
||||||
sx={{
|
sx={{
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
width: '36px',
|
width: '36px',
|
||||||
|
|
@ -25,7 +25,7 @@ const TabItem = ({ Icon, onClick, active }: IconProps) => {
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
<Icon size={20} />
|
<Icon size={20} />
|
||||||
</div>
|
</Button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,11 +65,10 @@ const UserAgentPage = ({ tab }: UserAgentPageProps) => {
|
||||||
display: tab === 'useragent' ? 'block' : 'none',
|
display: tab === 'useragent' ? 'block' : 'none',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box sx={{ fontSize: '20px', mb: '8px' }}>User Agent</Box>
|
<Box sx={{ fontSize: '20px', mb: '12px' }}>User Agent</Box>
|
||||||
<Flex
|
<Flex
|
||||||
sx={{
|
sx={{
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
mt: '12px',
|
|
||||||
mb: '8px',
|
mb: '8px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue