style(site): header flow, mobile features and showcases
This commit is contained in:
@@ -8,9 +8,10 @@ import ReactFlow, {
|
|||||||
import ColorPickerNode from './ColorPickerNode';
|
import ColorPickerNode from './ColorPickerNode';
|
||||||
|
|
||||||
const windowWidth = typeof window !== 'undefined' ? window.innerWidth : 0;
|
const windowWidth = typeof window !== 'undefined' ? window.innerWidth : 0;
|
||||||
|
const isSmallScreen = windowWidth < 800;
|
||||||
|
|
||||||
const getOffset = () => {
|
const getOffset = () => {
|
||||||
if (windowWidth < 800) {
|
if (isSmallScreen) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (windowWidth < 1200) {
|
} else if (windowWidth < 1200) {
|
||||||
return 405;
|
return 405;
|
||||||
@@ -20,8 +21,10 @@ const getOffset = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getColorNodeX = () => {
|
const getColorNodeX = () => {
|
||||||
if (windowWidth < 800) {
|
if (windowWidth < 600) {
|
||||||
return offsetLeft + 440;
|
return offsetLeft + 250;
|
||||||
|
} else if (isSmallScreen) {
|
||||||
|
return offsetLeft + 400;
|
||||||
} else if (windowWidth < 1000) {
|
} else if (windowWidth < 1000) {
|
||||||
return offsetLeft + 300;
|
return offsetLeft + 300;
|
||||||
} else if (windowWidth < 1200) {
|
} else if (windowWidth < 1200) {
|
||||||
@@ -86,28 +89,31 @@ export default () => {
|
|||||||
type: 'colorpicker',
|
type: 'colorpicker',
|
||||||
data: { color: 'red', value: 105, onChange },
|
data: { color: 'red', value: 105, onChange },
|
||||||
sourcePosition: 'right',
|
sourcePosition: 'right',
|
||||||
position: { x: offsetLeft + 50, y: 5 },
|
position: { x: offsetLeft + 50, y: isSmallScreen ? 250 : 5 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '2',
|
id: '2',
|
||||||
type: 'colorpicker',
|
type: 'colorpicker',
|
||||||
data: { color: 'green', value: 100, onChange },
|
data: { color: 'green', value: 100, onChange },
|
||||||
sourcePosition: 'right',
|
sourcePosition: 'right',
|
||||||
position: { x: offsetLeft, y: 150 },
|
position: { x: offsetLeft, y: isSmallScreen ? 325 : 150 },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '3',
|
id: '3',
|
||||||
data: { color: 'blue', value: 165, onChange },
|
data: { color: 'blue', value: 165, onChange },
|
||||||
type: 'colorpicker',
|
type: 'colorpicker',
|
||||||
sourcePosition: 'right',
|
sourcePosition: 'right',
|
||||||
position: { x: offsetLeft + 120, y: 300 },
|
position: {
|
||||||
|
x: isSmallScreen ? offsetLeft + 50 : offsetLeft + 120,
|
||||||
|
y: isSmallScreen ? 400 : 300,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '4',
|
id: '4',
|
||||||
data: { label: 'rgb(105, 100, 165)' },
|
data: { label: 'rgb(105, 100, 165)' },
|
||||||
targetPosition: 'left',
|
targetPosition: 'left',
|
||||||
sourcePosition: 'right',
|
sourcePosition: 'right',
|
||||||
position: { x: getColorNodeX(), y: 180 },
|
position: { x: getColorNodeX(), y: isSmallScreen ? 350 : 180 },
|
||||||
style: {
|
style: {
|
||||||
background: 'rgb(105, 100, 165)',
|
background: 'rgb(105, 100, 165)',
|
||||||
color: 'white',
|
color: 'white',
|
||||||
|
|||||||
@@ -52,9 +52,14 @@ const Showcases = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<CenterContent>
|
<CenterContent>
|
||||||
<Flex marginX={-gridPadding}>
|
<Flex marginX={[0, 0, -gridPadding]} flexWrap="wrap">
|
||||||
{showcases.map((showcase) => (
|
{showcases.map((showcase) => (
|
||||||
<Box key={showcase.title} width={1 / 3} px={gridPadding}>
|
<Box
|
||||||
|
key={showcase.title}
|
||||||
|
width={[1, 1, 1 / 3]}
|
||||||
|
px={[0, 0, gridPadding]}
|
||||||
|
mb={[3, 3, 0]}
|
||||||
|
>
|
||||||
<Link href={showcase.url} target="_blank" rel="noopener noreferrer">
|
<Link href={showcase.url} target="_blank" rel="noopener noreferrer">
|
||||||
<RoundImage fluid={showcase.image.childImageSharp.fluid} />
|
<RoundImage fluid={showcase.image.childImageSharp.fluid} />
|
||||||
<Title>{showcase.title}</Title>
|
<Title>{showcase.title}</Title>
|
||||||
@@ -64,7 +69,12 @@ const Showcases = () => {
|
|||||||
</Box>
|
</Box>
|
||||||
))}
|
))}
|
||||||
{emptyShowCases.map((index) => (
|
{emptyShowCases.map((index) => (
|
||||||
<Box key={index} width={1 / 3} px={gridPadding}>
|
<Box
|
||||||
|
key={index}
|
||||||
|
width={[1, 1, 1 / 3]}
|
||||||
|
px={[0, 0, gridPadding]}
|
||||||
|
mb={[3, 3, 0]}
|
||||||
|
>
|
||||||
<EmptyCase>
|
<EmptyCase>
|
||||||
<img src={reactFlowIconSrc} alt="react flow logo" />
|
<img src={reactFlowIconSrc} alt="react flow logo" />
|
||||||
</EmptyCase>
|
</EmptyCase>
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ const MobileButton = styled(Flex)`
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
|
@media ${device.tablet} {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const MenuLink = styled(Link)`
|
const MenuLink = styled(Link)`
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import ReactFlow, {
|
|||||||
import { H2, Text } from 'components/Typo';
|
import { H2, Text } from 'components/Typo';
|
||||||
import Icon from 'components/Icon';
|
import Icon from 'components/Icon';
|
||||||
import { baseColors } from 'themes';
|
import { baseColors } from 'themes';
|
||||||
|
import { device, getThemeSpacePx } from 'utils/css-utils';
|
||||||
|
|
||||||
const Wrapper = styled(Flex)`
|
const Wrapper = styled(Flex)`
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -23,6 +24,11 @@ const ReactFlowWrapper = styled(Box)`
|
|||||||
height: 400px;
|
height: 400px;
|
||||||
background: ${(p) => (p.isDark ? baseColors.violet : 'white')};
|
background: ${(p) => (p.isDark ? baseColors.violet : 'white')};
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
order: 2;
|
||||||
|
|
||||||
|
${device.tablet} {
|
||||||
|
order: ${(p) => p.order};
|
||||||
|
}
|
||||||
|
|
||||||
.react-flow__controls {
|
.react-flow__controls {
|
||||||
opacity: ${(p) => (p.isDark ? 0.5 : 1)};
|
opacity: ${(p) => (p.isDark ? 0.5 : 1)};
|
||||||
@@ -35,15 +41,24 @@ const DocsLink = styled(Link)`
|
|||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const DescriptionWrapper = styled(Box)`
|
||||||
|
order: 1;
|
||||||
|
margin-bottom: ${getThemeSpacePx(3)};
|
||||||
|
|
||||||
|
${device.tablet} {
|
||||||
|
order: ${(p) => p.order};
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
const Description = ({ title, description }) => (
|
const Description = ({ title, description }) => (
|
||||||
<Box width={[1, 1, 0.35]}>
|
<DescriptionWrapper width={[1, 1, 0.35]}>
|
||||||
<H2>{title}</H2>
|
<H2>{title}</H2>
|
||||||
<Text>{description}</Text>
|
<Text>{description}</Text>
|
||||||
<DocsLink to="/docs">
|
<DocsLink to="/docs">
|
||||||
Documentation{' '}
|
Documentation{' '}
|
||||||
<Icon width={24} name="arrow_right" colorizeStroke strokeColor="red" />
|
<Icon width={24} name="arrow_right" colorizeStroke strokeColor="red" />
|
||||||
</DocsLink>
|
</DocsLink>
|
||||||
</Box>
|
</DescriptionWrapper>
|
||||||
);
|
);
|
||||||
|
|
||||||
export default ({
|
export default ({
|
||||||
@@ -58,13 +73,18 @@ export default ({
|
|||||||
children,
|
children,
|
||||||
}) => {
|
}) => {
|
||||||
const bgColor = isDark ? baseColors.violetLighten60 : baseColors.violet;
|
const bgColor = isDark ? baseColors.violetLighten60 : baseColors.violet;
|
||||||
|
const reactFlowOrder = textPosition === 'left' ? 2 : 1;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Wrapper mb={[6, 6, 7]}>
|
<Wrapper mb={[6, 6, 7]}>
|
||||||
{textPosition === 'left' && (
|
{textPosition === 'left' && (
|
||||||
<Description title={title} description={description} />
|
<Description order={1} title={title} description={description} />
|
||||||
)}
|
)}
|
||||||
<ReactFlowWrapper width={[1, 1, 0.6]} isDark={isDark}>
|
<ReactFlowWrapper
|
||||||
|
width={[1, 1, 0.6]}
|
||||||
|
isDark={isDark}
|
||||||
|
order={reactFlowOrder}
|
||||||
|
>
|
||||||
{children ? (
|
{children ? (
|
||||||
children
|
children
|
||||||
) : (
|
) : (
|
||||||
@@ -82,7 +102,7 @@ export default ({
|
|||||||
)}
|
)}
|
||||||
</ReactFlowWrapper>
|
</ReactFlowWrapper>
|
||||||
{textPosition !== 'left' && (
|
{textPosition !== 'left' && (
|
||||||
<Description title={title} description={description} />
|
<Description order={2} title={title} description={description} />
|
||||||
)}
|
)}
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user