From 585bf7d2941f99526cff713b15cf003f265fdbe1 Mon Sep 17 00:00:00 2001 From: catalin_covic Date: Sun, 29 Mar 2020 14:28:26 -0700 Subject: [PATCH] update docs for css variable styling --- README.md | 1 + docs/js/sections/api.tsx | 14 ++++++ docs/js/sections/examples.tsx | 2 +- docs/js/sections/other.tsx | 88 +++++++++++++++++++++++++++++++++-- 4 files changed, 100 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 41ac6e3..f0f055b 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ TODO - simple to use with many customizable options - smooth, beautiful animations with [react spring](https://www.react-spring.io) - typescript support +- css variable support for custom styles ## Installation diff --git a/docs/js/sections/api.tsx b/docs/js/sections/api.tsx index f01beaf..3892742 100644 --- a/docs/js/sections/api.tsx +++ b/docs/js/sections/api.tsx @@ -1,6 +1,7 @@ import React from 'react' import Text from '../components/text' +import Link from '../components/link' import Code, { SYNTAX } from '../components/code' export default function Intro() { @@ -156,6 +157,19 @@ export default function Intro() {
Custom done button as render props. See below for example.
+ + {/* custom styles */} +

+ custom styling +

+ +
+ + + See below for examples + + +
) } diff --git a/docs/js/sections/examples.tsx b/docs/js/sections/examples.tsx index c3c5146..42d9f79 100644 --- a/docs/js/sections/examples.tsx +++ b/docs/js/sections/examples.tsx @@ -149,7 +149,7 @@ function YourComponent(){ {/* example 4 */} -
+
Custom done button
diff --git a/docs/js/sections/other.tsx b/docs/js/sections/other.tsx index bf007bf..469c2da 100644 --- a/docs/js/sections/other.tsx +++ b/docs/js/sections/other.tsx @@ -1,17 +1,97 @@ import React from 'react' import Text from '../components/text' +import Link from '../components/link' import Code, { SYNTAX } from '../components/code' export default function Other() { return ( -
+

Custom styles

-
+ There are two ways of overriding/customizing styles: + + CSS variables: for changing basic styling - mainly text colors, + background colors, fonts, etc. See{' '} + + using CSS variables + {' '} + for more info. + + + {`// global override +:root { + --meridiem-bg-color: green; + --meridiem-text-color: red; +} + +// container specific +.foo { + --meridiem-bg-color: green; + --meridiem-text-color: red; +} +`} + + + The full list of supported variables are: + + {`// main wrapper +var(--main-box-shadow, 0 3px 11px rgba(0, 0, 0, 0.1), 0 3px 6px rgba(0, 0, 0, 0.15)) +var(--main-bg, white) +var(--main-font-family, 'Roboto', sans-serif) + +// top bar +var(--top-bg, white) +var(--top-colon-color, #8C8C8C) +var(--top-text-color, #8C8C8C) +var(--top-selected-color, #8EDDFD) +var(--top-meridiem-color, #8C8C8C) + +// time dropdown +var(--dropdown-border, 1px solid #f4f4f4) +var(--dropdown-shadow, 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24)) +var(--dropdown-text-color, #8c8c8c) +var(--dropdown-hover-bg, #EAF8FF) + +// clock wrapper +var(--clock-wrapper-bg, #f4f4f4); +var(--clock-bg, white); + +// clock hand +var(--hand-line-color, #bceaff); +var(--hand-circle-center, #bceaff); +var(--hand-circle-outer, #e6f7ff); +var(--hand-minute-circle, #ade2fb); // minutes only, dot between intervals + +// numbers +var(--numbers-text-color, #999); +var(--numbers-font-size-reg, 16px); // 12h mode only +var(--numbers-font-size-inner, 15px); // 24h mode only +var(--numbers-font-size-outer, 13px); // 24h mode only + + +// meridiem buttons +var(--meridiem-bg-color, white); +var(--meridiem-text-color, #898989); +var(--meridiem-selected-bg-color, #E1EFF6); +var(--meridiem-selected-text-color, #898989); + +// done button +var(--done-bg-color, #f4f4f4); +var(--done-text-color, #686868); +var(--done-border-top, 1px solid #ccc); +var(--done-font-size, 13px); +var(--done-font-weight, 500); +`} + + +
- For changing colors, each element has a class name you can override properties - with 1 level of specifity. + Higher CSS specificity: for more control over css, each element + has a class name you can override properties with 1 level of specifity. {`// won't work because emotion will override your styles