From f90486c99c7acf95f3b95fdc73ee125dd3f9086e Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Tue, 6 Nov 2018 11:34:04 -0800 Subject: wip: mediachoice experiment --- packages/instant/src/components/sandbox.tsx | 22 ++++++++++++++++++++++ .../src/components/zero_ex_instant_container.tsx | 2 ++ packages/instant/src/style/media.ts | 13 +++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 packages/instant/src/components/sandbox.tsx (limited to 'packages') diff --git a/packages/instant/src/components/sandbox.tsx b/packages/instant/src/components/sandbox.tsx new file mode 100644 index 000000000..04e4c7935 --- /dev/null +++ b/packages/instant/src/components/sandbox.tsx @@ -0,0 +1,22 @@ +import * as React from 'react'; + +import { MediaChoice, stylesForMedia } from '../style/media'; +import { styled } from '../style/theme'; + +// export const Sandbox: React.StatelessComponent<{}> = props => { +// return
Hi
; +// }; + +// TODO: handle string too +interface SandboxProps { + width: MediaChoice; +} +export const Sandbox = + styled.div < + SandboxProps > + ` + display: block; + border: 1px solid black; + background-color: yellow; + ${props => stylesForMedia(props.width)} + `; diff --git a/packages/instant/src/components/zero_ex_instant_container.tsx b/packages/instant/src/components/zero_ex_instant_container.tsx index 88c838567..8fd4d56c3 100644 --- a/packages/instant/src/components/zero_ex_instant_container.tsx +++ b/packages/instant/src/components/zero_ex_instant_container.tsx @@ -12,6 +12,7 @@ import { ColorOption } from '../style/theme'; import { zIndex } from '../style/z_index'; import { SlideAnimationState } from './animations/slide_animation'; +import { Sandbox } from './sandbox'; import { SlidingPanel } from './sliding_panel'; import { Container, Flex } from './ui'; @@ -27,6 +28,7 @@ export class ZeroExInstantContainer extends React.Component + Test diff --git a/packages/instant/src/style/media.ts b/packages/instant/src/style/media.ts index fa7571077..5a0cba668 100644 --- a/packages/instant/src/style/media.ts +++ b/packages/instant/src/style/media.ts @@ -1,3 +1,5 @@ +import { InterpolationValue } from 'styled-components'; + import { css } from './theme'; export enum ScreenWidths { @@ -17,3 +19,14 @@ export const media = { medium: generateMediaWrapper(ScreenWidths.Md), large: generateMediaWrapper(ScreenWidths.Lg), }; + +/// media helper +export interface MediaChoice { + sm: string; + md?: string; + lg?: string; +} +// TODO: handle string too +export const stylesForMedia = (choice: MediaChoice): InterpolationValue[] => { + return media.small`width: ${choice.sm}`; +}; -- cgit