From 3e060d0e8192174e87a313b96f4f13ed030dce8a Mon Sep 17 00:00:00 2001 From: Chef Hutch <79279477+ChefHutch@users.noreply.github.com> Date: Tue, 1 Jun 2021 09:12:37 +0100 Subject: [PATCH] (styles) Add some initial new lottery styles (#1385) * style(page-section): Improve readibility of section styles * style(lottery-v2): Sneaking in some page styles * style(lottery-v2): PageSectionStyles tidy * style(page-section): Further simplification and improvement of styles --- src/components/PageSection/CurvedDivider.tsx | 12 ++-- src/components/PageSection/index.tsx | 29 ++++++---- src/components/PageSection/svg/CurvedSvg.tsx | 1 + .../components/TicketsNumberButton.tsx | 22 +++++++ src/views/LotteryV2/pageSectionStyles.tsx | 4 ++ .../LotteryV2/svgs/TicketPurchaseCard.tsx | 57 +++++++++++++++++++ src/views/LotteryV2/svgs/index.tsx | 3 + src/views/TradingCompetition/index.tsx | 26 +++++++-- 8 files changed, 130 insertions(+), 24 deletions(-) create mode 100644 src/views/LotteryV2/components/TicketsNumberButton.tsx create mode 100644 src/views/LotteryV2/pageSectionStyles.tsx create mode 100644 src/views/LotteryV2/svgs/TicketPurchaseCard.tsx create mode 100644 src/views/LotteryV2/svgs/index.tsx diff --git a/src/components/PageSection/CurvedDivider.tsx b/src/components/PageSection/CurvedDivider.tsx index 7aa103a063d25..e01e936d0da96 100644 --- a/src/components/PageSection/CurvedDivider.tsx +++ b/src/components/PageSection/CurvedDivider.tsx @@ -5,25 +5,21 @@ import { CurvedSvgTop, CurvedSvgBottom } from './svg/CurvedSvg' interface CurvedDividerProps extends WrapperProps { svgFill?: string dividerComponent?: React.ReactNode + curvePosition?: 'top' | 'bottom' } interface WrapperProps { index: number - curvePosition?: 'top' | 'bottom' } const Wrapper = styled.div` + z-index: ${({ index }) => index}; position: relative; display: flex; align-items: center; width: 100%; - z-index: ${({ index }) => index}; - margin: ${({ curvePosition }) => (curvePosition === 'top' ? '-32px' : '32px')} 0 0; - ${({ theme }) => theme.mediaQueries.sm} { - margin: ${({ curvePosition }) => (curvePosition === 'top' ? '-40px' : '40px')} 0 0; - } ` -const ComponentWrapper = styled.div<{ index: number }>` +const ComponentWrapper = styled.div` z-index: ${({ index }) => index + 1}; position: absolute; top: 50%; @@ -33,7 +29,7 @@ const ComponentWrapper = styled.div<{ index: number }>` const CurvedDivider: React.FC = ({ svgFill, index, curvePosition, dividerComponent }) => { return ( - + {dividerComponent && {dividerComponent}} {curvePosition === 'top' ? ( diff --git a/src/components/PageSection/index.tsx b/src/components/PageSection/index.tsx index 816311245e4a0..62a3fcdb21273 100644 --- a/src/components/PageSection/index.tsx +++ b/src/components/PageSection/index.tsx @@ -14,7 +14,6 @@ interface PageSectionProps extends BackgroundColorProps { interface BackgroundColorProps extends FlexProps { index: number background?: string - hasZeroMargin?: boolean } const BackgroundColor = styled(Flex)` @@ -22,14 +21,6 @@ const BackgroundColor = styled(Flex)` flex-direction: column; z-index: ${({ index }) => index - 1}; background: ${({ background, theme }) => background || theme.colors.background}; - padding: 48px 0; - margin: ${({ hasZeroMargin }) => (hasZeroMargin ? '0' : '-32px')} 0; - ${({ theme }) => theme.mediaQueries.sm} { - margin: ${({ hasZeroMargin }) => (hasZeroMargin ? '0' : '-52px')} 0; - } - @media screen and (min-width: 1920px) { - margin: ${({ hasZeroMargin }) => (hasZeroMargin ? '0' : '-72px')} 0; - } ` const ChildrenWrapper = styled(Container)` @@ -58,7 +49,23 @@ const PageSection: React.FC = ({ hasCurvedDivider = true, ...props }) => { - const hasZeroMargin = !hasCurvedDivider || curvePosition === 'top' + const getPadding = () => { + // No curved divider + if (!hasCurvedDivider) { + return '48px 0' + } + // Bottom curved divider + // Less bottom padding, as the divider is present there + if (curvePosition === 'bottom') { + return '48px 0 14px' + } + // Top curved divider + // Less top padding, as the divider is present there + if (curvePosition === 'top') { + return '14px 0 48px' + } + return '48px 0' + } return ( <> @@ -70,7 +77,7 @@ const PageSection: React.FC = ({ dividerComponent={dividerComponent} /> )} - + {children} {hasCurvedDivider && curvePosition === 'bottom' && ( diff --git a/src/components/PageSection/svg/CurvedSvg.tsx b/src/components/PageSection/svg/CurvedSvg.tsx index 3af75b3ad3116..c101a4e784769 100644 --- a/src/components/PageSection/svg/CurvedSvg.tsx +++ b/src/components/PageSection/svg/CurvedSvg.tsx @@ -52,5 +52,6 @@ export const CurvedSvgTop = styled(CurvedSvg)` export const CurvedSvgBottom = styled(CurvedSvg)` ${sharedStyles} + margin-top: -2px; fill: ${({ svgFill, theme }) => svgFill || theme.colors.background}; ` diff --git a/src/views/LotteryV2/components/TicketsNumberButton.tsx b/src/views/LotteryV2/components/TicketsNumberButton.tsx new file mode 100644 index 0000000000000..c363cd42cd56b --- /dev/null +++ b/src/views/LotteryV2/components/TicketsNumberButton.tsx @@ -0,0 +1,22 @@ +import React from 'react' +import styled from 'styled-components' +import { Button } from '@pancakeswap/uikit' + +interface TicketsNumberButtonProps { + onClick: () => void + disabled?: boolean +} + +const StyledButton = styled(Button)` + flex-grow: 1; +` + +const TicketsNumberButton: React.FC = ({ children, onClick, disabled = false }) => { + return ( + + {children} + + ) +} + +export default TicketsNumberButton diff --git a/src/views/LotteryV2/pageSectionStyles.tsx b/src/views/LotteryV2/pageSectionStyles.tsx new file mode 100644 index 0000000000000..d3fc2ecd755ce --- /dev/null +++ b/src/views/LotteryV2/pageSectionStyles.tsx @@ -0,0 +1,4 @@ +export const TITLE_BG = 'linear-gradient(180deg, #7645D9 0%, #452A7A 100%)' +export const GET_TICKETS_BG = 'linear-gradient(180deg, #7645D9 0%, #5121B1 100%)' +export const FINISHED_ROUNDS_BG = 'linear-gradient(180deg, #CBD7EF 0%, #9A9FD0 100%)' +export const FINISHED_ROUNDS_BG_DARK = 'linear-gradient(180deg, #434575 0%, #66578D 100%)' diff --git a/src/views/LotteryV2/svgs/TicketPurchaseCard.tsx b/src/views/LotteryV2/svgs/TicketPurchaseCard.tsx new file mode 100644 index 0000000000000..55077ee337b61 --- /dev/null +++ b/src/views/LotteryV2/svgs/TicketPurchaseCard.tsx @@ -0,0 +1,57 @@ +import React from 'react' +import { Svg, SvgProps } from '@pancakeswap/uikit' + +const TicketPurchaseCard: React.FC = (props) => { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + ) +} + +export default TicketPurchaseCard diff --git a/src/views/LotteryV2/svgs/index.tsx b/src/views/LotteryV2/svgs/index.tsx new file mode 100644 index 0000000000000..f59885f90fe22 --- /dev/null +++ b/src/views/LotteryV2/svgs/index.tsx @@ -0,0 +1,3 @@ +// TODO: Remove with additional imports +// eslint-disable-next-line import/prefer-default-export +export { default as TicketPurchaseCard } from './TicketPurchaseCard' diff --git a/src/views/TradingCompetition/index.tsx b/src/views/TradingCompetition/index.tsx index ab3787873186e..cf672dba30f28 100644 --- a/src/views/TradingCompetition/index.tsx +++ b/src/views/TradingCompetition/index.tsx @@ -57,6 +57,20 @@ const BannerFlex = styled(Flex)` } ` +const BattleBannerSection = styled(PageSection)` + margin-top: -32px; + ${({ theme }) => theme.mediaQueries.lg} { + margin-top: -64px; + } +` + +const YourScoreSection = styled(PageSection)` + margin-top: -32px; + ${({ theme }) => theme.mediaQueries.lg} { + margin-top: -64px; + } +` + const PrizesSection = styled(PageSection)` margin: -32px 0; ${({ theme }) => theme.mediaQueries.lg} { @@ -215,7 +229,7 @@ const TradingCompetition = () => { return ( - { - - + { /> )} - + { } > - + + +