import React from 'react';
import styled from '@emotion/styled';
import { Flex, Box } from 'reflexbox';
import Link from 'gatsby-link';
import ReactFlow, {
ReactFlowProvider,
Background,
Controls,
MiniMap,
} from 'react-flow-renderer';
import { H2, Text } from 'components/Typo';
import Icon from 'components/Icon';
import { baseColors } from 'themes';
import { device, getThemeSpacePx } from 'utils/css-utils';
const Wrapper = styled(Flex)`
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
`;
const ReactFlowWrapper = styled(Box)`
height: 400px;
background: ${(p) => (p.isDark ? baseColors.violet : 'white')};
border-radius: 10px;
order: 2;
margin: 30px 0;
border: solid rgba(26, 25, 43, 0.054) 1.5px;
box-shadow: 0 2.8px 2.2px rgba(26, 25, 43, 0.014),
0 12.5px 10px rgba(26, 25, 43, 0.02),
0 22.3px 17.9px rgba(26, 25, 43, 0.022),
0 41.8px 33.4px rgba(26, 25, 43, 0.026), 0 100px 80px rgba(26, 25, 43, 0.02);
@media ${device.tablet} {
order: ${(p) => p.order};
}
.react-flow__controls {
opacity: ${(p) => (p.isDark ? 0.5 : 1)};
}
`;
const DocsLink = styled(Link)`
display: flex;
font-weight: bold;
align-items: center;
margin-top: 16px;
svg {
transform: translateX(0px);
transition: all 0.125s ease-in-out;
}
&:hover {
svg {
transform: translateX(5px);
transition: all 0.125s ease-in-out;
}
}
`;
const DescriptionWrapper = styled(Box)`
order: 1;
margin-bottom: ${getThemeSpacePx(3)};
@media ${device.tablet} {
order: ${(p) => p.order};
}
`;
const Description = ({ title, description }) => (
{title}
{description}
Documentation{' '}
);
export default ({
title,
description,
textPosition = 'left',
flowProps,
withControls = false,
withMinimap = false,
isDark = false,
linesBg = false,
children,
}) => {
const bgColor = isDark ? baseColors.violetLighten60 : baseColors.violet;
const reactFlowOrder = textPosition === 'left' ? 2 : 1;
return (
{textPosition === 'left' && (
)}
{children ? (
children
) : (
{withControls && }
{withMinimap && }
)}
{textPosition !== 'left' && (
)}
);
};