aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/style
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-07 05:52:16 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-07 05:52:16 +0800
commite8814ecbe70b97dfa0de0f51b6a3b7e7fcd89ea2 (patch)
tree0e9060db27fd6b027ca94e6a0c3382b8c4010f5d /packages/instant/src/style
parentf90486c99c7acf95f3b95fdc73ee125dd3f9086e (diff)
downloaddexon-sol-tools-e8814ecbe70b97dfa0de0f51b6a3b7e7fcd89ea2.tar
dexon-sol-tools-e8814ecbe70b97dfa0de0f51b6a3b7e7fcd89ea2.tar.gz
dexon-sol-tools-e8814ecbe70b97dfa0de0f51b6a3b7e7fcd89ea2.tar.bz2
dexon-sol-tools-e8814ecbe70b97dfa0de0f51b6a3b7e7fcd89ea2.tar.lz
dexon-sol-tools-e8814ecbe70b97dfa0de0f51b6a3b7e7fcd89ea2.tar.xz
dexon-sol-tools-e8814ecbe70b97dfa0de0f51b6a3b7e7fcd89ea2.tar.zst
dexon-sol-tools-e8814ecbe70b97dfa0de0f51b6a3b7e7fcd89ea2.zip
proof of concept working
Diffstat (limited to 'packages/instant/src/style')
-rw-r--r--packages/instant/src/style/media.ts23
1 files changed, 20 insertions, 3 deletions
diff --git a/packages/instant/src/style/media.ts b/packages/instant/src/style/media.ts
index 5a0cba668..84b85a2a8 100644
--- a/packages/instant/src/style/media.ts
+++ b/packages/instant/src/style/media.ts
@@ -21,12 +21,29 @@ export const media = {
};
/// media helper
-export interface MediaChoice {
- sm: string;
+export interface ScreenSpecifications {
+ default: string;
+ sm?: string;
md?: string;
lg?: string;
}
+export type MediaChoice = string | ScreenSpecifications;
// TODO: handle string too
export const stylesForMedia = (choice: MediaChoice): InterpolationValue[] => {
- return media.small`width: ${choice.sm}`;
+ let res: InterpolationValue[];
+ if (typeof choice === 'string') {
+ res = css`
+ width: ${choice};
+ `;
+ } else {
+ res = css`
+ width: ${choice.default};
+ ${choice.lg && media.large`width: ${choice.lg}`}
+ ${choice.md && media.medium`width: ${choice.md}`}
+ ${choice.sm && media.small`width: ${choice.sm}`}
+ `;
+ }
+
+ console.log(res.toString());
+ return res;
};