UNPKG

@patreon/studio

Version:

Patreon Studio Design System

72 lines (69 loc) 2.29 kB
// TODO (legacied filenames/match-regex) // This failure is legacied in and should be updated. DO NOT COPY. // eslint-disable-next-line filenames/match-regex import React from 'react'; import styled, { css } from 'styled-components'; import { cssForMountTransition } from '../../hooks/useMountTransition'; import { tokens } from '../../tokens'; import { mediaForBreakpoint } from '../../utilities/breakpoints'; import { IS_HAPPO } from '../../utilities/env'; import { NarrowContent, WideContent, MiniContent, FluidContent } from '../Areas'; const mobileBreakpoint = () => mediaForBreakpoint('sm'); export const Root = styled.div ` --viewport-height: ${(props) => props.$viewportHeight}px; top: 0; left: 0; right: 0; bottom: 0; margin: 0; isolation: isolate; z-index: ${tokens.global.layer.z12}; position: fixed; will-change: opacity; overflow: auto; background: ${tokens.global.bg.baseAlt.default}; ${(props) => !IS_HAPPO && cssForMountTransition({ isActive: props.$isOpen, transitionPhase: props.$transitionPhase, transition: css ` transition: 350ms ease; transition-property: opacity, transform; `, unmounted: css ` transform: translateY(2rem); opacity: 0; `, mounted: css ` opacity: 1; `, })} `; export const Wrapper = styled.div ` position: relative; display: flex; align-items: center; justify-content: center; padding-top: 56px; padding-bottom: 56px; z-index: 2; min-height: calc(var(--viewport-height) - 56px * 2); @media ${mobileBreakpoint} { padding-top: 80px; padding-bottom: 80px; min-height: calc(var(--viewport-height) - 80px * 2); } `; export const Area = ({ contentWidth, children }) => { if (contentWidth === 'narrow') { return <NarrowContent id={`${contentWidth}-content`}>{children}</NarrowContent>; } if (contentWidth === 'mini') { return <MiniContent id={`${contentWidth}-content`}>{children}</MiniContent>; } if (contentWidth === 'fluid') { return <FluidContent id={`${contentWidth}-content`}>{children}</FluidContent>; } return <WideContent id={`${contentWidth}-content`}>{children}</WideContent>; }; //# sourceMappingURL=styled-components.jsx.map