Skip to content

V2.0 #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Mar 14, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: mobile device responsive styles
  • Loading branch information
lokesh-coder committed Mar 14, 2021
commit 9a6eeefceaa51a6b177c4fa25bc68f0256888cdf
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"license": "MIT",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"develop": "gatsby develop -H 0.0.0.0",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
"start": "npm run develop",
"serve": "gatsby serve",
Expand Down
3 changes: 3 additions & 0 deletions src/@chakra-ui/gatsby-plugin/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const theme = extendTheme({
body: {
bg: colorMode === 'dark' ? 'blue.800' : 'white',
},
'.chakra-modal__content-container': {
p: { base: '2', lg: '0' },
},
'#blobSvg': {
overflow: 'visible',
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/Common/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Input = ({ value, onEnter }) => (
defaultValue={value}
_focus={{ borderColor: 'primary', boxShadow: '0 0 0 1px #d7819b' }}
onKeyDown={(e) => {
if (e.code !== 'Enter') return;
if (e.key !== 'Enter') return;
if (!validateHex(e.target.value)) return;
onEnter(e.target.value);
}}
Expand Down
31 changes: 18 additions & 13 deletions src/components/Common/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,26 @@ const Modal = ({ title, src, children, actions, size = '2xl' }) => {
<ModalOverlay background="rgba(78,86,107,0.71)" />
<ModalContent>
<ModalHeader px="10">
<Flex justify="space-between" align="center">
<Heading fontSize="xl" variant="main">
{title}
</Heading>
<Flex>
<Flex align="center">
<Flex
direction={{ base: 'column', lg: 'row' }}
align="center"
justify={{ base: 'center', lg: 'space-between' }}
flex="1"
>
<Heading fontSize="xl" variant="main">
{title}
</Heading>
<Box>{actions}</Box>
<Button
onClick={onClose}
variant="subtle"
pos="relative"
right="-20px"
>
<CloseIcon />
</Button>
</Flex>
<Button
onClick={onClose}
variant="subtle"
pos="relative"
right="-20px"
>
<CloseIcon />
</Button>
</Flex>
</ModalHeader>
<Divider />
Expand Down
113 changes: 64 additions & 49 deletions src/components/Common/Popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,56 +10,71 @@ import {
PopoverTrigger,
Tooltip,
} from '@chakra-ui/react';
import React from 'react';
import React, { useState } from 'react';

const Popover = ({ props, children, label, trigger }) => (
<ChakPopover autoFocus={false} isLazy placement="top" arrowSize="0">
<PopoverTrigger>
<Box>
{!!trigger && <Box>{trigger}</Box>}
{!trigger && (
<Box>
<Tooltip
label={label}
aria-label={label}
hasArrow
variant="default"
>
<Box
as="button"
p="15px"
_focus={{ outline: 0 }}
_hover={{ boxShadow: 'xl' }}
rounded="2xl"
{...props}
/>
</Tooltip>
</Box>
)}
</Box>
</PopoverTrigger>
<PopoverContent
bg="gray.50"
shadow="2xl"
_dark={{ bg: 'gray.700' }}
_focus={{ boxShadow: 'none', outline: 'none' }}
const Popover = ({ props, children, label, trigger }) => {
const [isOpen, setIsOpen] = useState(false);
const open = () => setIsOpen(!isOpen);
const close = () => setIsOpen(false);

return (
<ChakPopover
autoFocus={false}
isLazy
placement="top"
arrowSize="0"
isOpen={isOpen}
onClose={close}
>
<PopoverArrow />
<PopoverCloseButton mt="6px" />
<PopoverHeader py="3">
<Heading
fontSize="md"
letterSpacing="-0.9px"
textAlign="center"
fontWeight="700"
variant="main"
>
{label}
</Heading>
</PopoverHeader>
<PopoverBody p="0">{children}</PopoverBody>
</PopoverContent>
</ChakPopover>
);
<PopoverTrigger>
<Box onClick={open}>
{!!trigger && <Box>{trigger}</Box>}
{!trigger && (
<Box>
<Tooltip
label={label}
aria-label={label}
hasArrow
variant="default"
>
<Box
as="button"
p="15px"
_focus={{ outline: 0 }}
_hover={{ boxShadow: 'xl' }}
rounded="2xl"
{...props}
/>
</Tooltip>
</Box>
)}
</Box>
</PopoverTrigger>
<PopoverContent
bg="gray.50"
shadow="2xl"
_dark={{ bg: 'gray.700' }}
_focus={{ boxShadow: 'none', outline: 'none' }}
>
<PopoverArrow />
<PopoverCloseButton mt="6px" />
<PopoverHeader py="3">
<Heading
fontSize="md"
letterSpacing="-0.9px"
textAlign="center"
fontWeight="700"
variant="main"
>
{label}
</Heading>
</PopoverHeader>
<PopoverBody p="0">
{typeof children === 'function' ? children(close) : children}
</PopoverBody>
</PopoverContent>
</ChakPopover>
);
};

export default Popover;
2 changes: 1 addition & 1 deletion src/components/Common/UrlInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const UrlInput = ({ value, onEnter }) => {
defaultValue={value}
_focus={{ borderColor: 'primary', boxShadow: '0 0 0 1px #d7819b' }}
onKeyDown={(e) => {
if (e.code !== 'Enter') return;
if (e.key !== 'Enter') return;
const url = e.target.value;
if (!urlRegex.test(url)) {
setError('Invalid URL');
Expand Down
44 changes: 33 additions & 11 deletions src/components/Settings/GradientColorsPicker.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react/jsx-wrap-multilines */
import React from 'react';
import { Box, Divider, Flex } from '@chakra-ui/react';
import { dynamic } from '../../state';
Expand Down Expand Up @@ -38,23 +39,44 @@ const GradientColorsPicker = ({
}
/>
);
const Content = ({ close }) => (
<Box>
<Pallette
onClick={(value) => {
switchToGradientColors(value);
close();
}}
colors={defaultColors}
/>
<Divider mb="4" />
<Box p="3" pt="0">
<Flex>
<Input
value={start}
onEnter={(value) => {
updateGradientStartColor(value);
close();
}}
/>
<Divider mx="2" orientation="vertical" />
<Input
value={end}
onEnter={(value) => {
updateGradientEndColor(value);
close();
}}
/>
</Flex>
</Box>
</Box>
);
return (
<Popover
props={{ bgGradient: `linear(to-b, ${start}, ${end})` }}
label="Gradient colors"
trigger={<Picker />}
>
<Box>
<Pallette onClick={switchToGradientColors} colors={defaultColors} />
<Divider mb="4" />
<Box p="3" pt="0">
<Flex>
<Input value={start} onEnter={updateGradientStartColor} />
<Divider mx="2" orientation="vertical" />
<Input value={end} onEnter={updateGradientEndColor} />
</Flex>
</Box>
</Box>
{(close) => <Content close={close} />}
</Popover>
);
};
Expand Down
24 changes: 14 additions & 10 deletions src/components/Settings/ImageSetter.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import { Box } from '@chakra-ui/react';
import { Box, Button } from '@chakra-ui/react';
import { dynamic } from '../../state';
import Popover from '../Common/Popover';
import UrlInput from '../Common/UrlInput';
import Ding from '../Common/Ding';
import { ImageIcon, LandscapeIcon } from '../icons';
import { ImageIcon, LandscapeIcon, RightArrowIcon } from '../icons';

const ImageSetter = ({ type, image, switchToImage }) => {
const Picker = () => (
Expand All @@ -15,16 +15,20 @@ const ImageSetter = ({ type, image, switchToImage }) => {
activeComp={<LandscapeIcon color="primary" />}
/>
);
const Content = ({ close }) => (
<Box p="3" textAlign="center">
<UrlInput
value={image}
onEnter={(value) => {
switchToImage(value);
close();
}}
/>
</Box>
);
return (
<Popover props={{ bg: 'red' }} label="Set image" trigger={<Picker />}>
<Box p="3">
<UrlInput
value={image}
onEnter={(url) => {
switchToImage(url);
}}
/>
</Box>
{(close) => <Content close={close} />}
</Popover>
);
};
Expand Down
31 changes: 19 additions & 12 deletions src/components/Settings/PatternSetter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable react/jsx-wrap-multilines */
import React, { useState } from 'react';
import { Box, Text, useColorModeValue } from '@chakra-ui/react';
import React from 'react';
import { Box, useColorModeValue } from '@chakra-ui/react';
import { dynamic } from '../../state';
import Popover from '../Common/Popover';
import * as Patterns from '../../patterns';
Expand Down Expand Up @@ -63,18 +63,25 @@ const PatternSetter = ({ type, pattern, switchToPattern }) => {
);
};

const Content = ({ close }) => (
<Box p="3">
{Object.keys(Patterns).map((name) => (
<PatternBox
key={name}
meta={Patterns[name]}
clickHandler={(value) => {
switchToPattern(value);
close();
}}
isSelected={pattern === name}
/>
))}
</Box>
);

return (
<Popover props={{ bg: 'red' }} label="Set pattern" trigger={<Picker />}>
<Box p="3">
{Object.keys(Patterns).map((name) => (
<PatternBox
key={name}
meta={Patterns[name]}
clickHandler={switchToPattern}
isSelected={pattern === name}
/>
))}
</Box>
{(close) => <Content close={close} />}
</Popover>
);
};
Expand Down
20 changes: 15 additions & 5 deletions src/components/Settings/SolidColorPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,30 @@ const SolidColorPicker = ({ type, color, switchToSolidColor }) => {
<Ding
label="Color"
Icon={PaintIcon}
isSelected={type == 'solid'}
isSelected={type === 'solid'}
activeComp={<Box p="4px" rounded="2xl" bg={color} w="1px" />}
/>
);

return (
<Popover props={{ bg: color }} label="Choose a color" trigger={<Picker />}>
const Content = ({ close }) => {
const selectAndClose = (value) => {
switchToSolidColor(value);
close();
};
return (
<Box>
<Pallette onClick={switchToSolidColor} colors={defaultColors} />
<Pallette onClick={selectAndClose} colors={defaultColors} />
<Divider mb="4" />
<Box p="3" pt="0">
<Input value={color} onEnter={switchToSolidColor} />
<Input value={color} onEnter={selectAndClose} />
</Box>
</Box>
);
};

return (
<Popover props={{ bg: color }} label="Choose a color" trigger={<Picker />}>
{(close) => <Content close={close} />}
</Popover>
);
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/seo.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function SEO({ description, lang, meta, title }) {
},
{
property: 'og:image',
content: '/blobs_app_poster.png',
content: 'https://blobs.app/blobs_app_poster.png',
},
{
name: 'twitter:card',
Expand All @@ -83,7 +83,7 @@ function SEO({ description, lang, meta, title }) {
},
{
name: 'twitter:image',
content: '/blobs_app_poster.png',
content: 'https://blobs.app/blobs_app_poster.png',
},
].concat(meta)}
/>
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy