From 3258eb02236e5ac358df4e6dfd51ee86aea08ffa Mon Sep 17 00:00:00 2001 From: Aminejvm Date: Thu, 25 Mar 2021 11:47:15 +0100 Subject: [PATCH] added more slider style props --- components/core/FontFrame/Controls.js | 28 +++++++++++ components/system/components/Slider.js | 6 +-- pages/_/system/sliders.js | 66 ++++++++++++++------------ 3 files changed, 66 insertions(+), 34 deletions(-) diff --git a/components/core/FontFrame/Controls.js b/components/core/FontFrame/Controls.js index 70b25299..d513f19d 100644 --- a/components/core/FontFrame/Controls.js +++ b/components/core/FontFrame/Controls.js @@ -329,6 +329,34 @@ const Controller = ({ value, options, onChange, selectSuffix = "", label, min, m value={value} onChange={onChange} containerStyle={{ height: "auto", marginLeft: "18px" }} + sliderBarStyle={(theme) => css` + background-color: ${theme.fontPreviewDarkMode + ? theme.system.gray70 + : theme.system.gray30}; + `} + activeBarStyle={(theme) => css` + background-color: ${theme.fontPreviewDarkMode + ? theme.system.white + : theme.system.gray80}; + `} + handleStyle={(theme) => css` + background-color: ${theme.fontPreviewDarkMode + ? theme.system.white + : theme.system.gray80}; + + :hover { + box-shadow: 0 0 0 4px + ${theme.fontPreviewDarkMode + ? "rgba(255, 255, 255, 0.1)" + : "rgba(75, 74, 77, 0.1)"}; + } + :active { + box-shadow: 0 0 0 8px + ${theme.fontPreviewDarkMode + ? "rgba(255, 255, 255, 0.2)" + : "rgba(75, 74, 77, 0.2)"}; + } + `} /> diff --git a/components/system/components/Slider.js b/components/system/components/Slider.js index 3a4eab82..361fb668 100644 --- a/components/system/components/Slider.js +++ b/components/system/components/Slider.js @@ -188,13 +188,13 @@ export class Slider extends React.Component {
{ this._bar = c; }} />
-
+
{this.props.bubble ?
{this.props.value}
: null}
diff --git a/pages/_/system/sliders.js b/pages/_/system/sliders.js index 1ee36f29..b0b9333a 100644 --- a/pages/_/system/sliders.js +++ b/pages/_/system/sliders.js @@ -21,19 +21,13 @@ export default class SystemPageSliders extends React.Component { render() { return ( - + Sliders

- - The Slider component is used to select from a range of numeric values. - + The Slider component is used to select from a range of numeric values.


@@ -74,12 +68,10 @@ import { Slider } from "slate-react-system";`} />
- Declare the Slider component, specifying a{" "} - min,{" "} - max, and{" "} - step. Declaring{" "} - discrete true will yield a slider - that snaps to each step. + Declare the Slider component, specifying a min,{" "} + max, and step. + Declaring discrete true will yield a slider that snaps + to each step.

@@ -149,11 +141,10 @@ import { Slider } from "slate-react-system";`} />
- You can declare the Slider component with{" "} - inputBox or{" "} - bubble to include a display of the - value. Values can be entered in the input box and the input box can be - styled with inputStyle. + You can declare the Slider component with inputBox or{" "} + bubble to include a display of the value. Values can be + entered in the input box and the input box can be styled with{" "} + inputStyle.

@@ -213,22 +204,14 @@ import { Slider } from "slate-react-system";`} rows: [ { id: 1, - a: ( - - onChange - - ), + a: onChange, b: "function", c: "null", d: "Function called upon an onChange event", }, { id: 2, - a: ( - - value - - ), + a: value, b: "number", c: "null", d: @@ -312,8 +295,7 @@ import { Slider } from "slate-react-system";`} a: "inputStyle", b: "Object", c: "null", - d: - "Style applied to the input box (useful for specifying width, etc).", + d: "Style applied to the input box (useful for specifying width, etc).", }, { id: 14, @@ -323,6 +305,28 @@ import { Slider } from "slate-react-system";`} d: "Style applied to the container holding the slider and input box (useful for specifying margin or height, etc).", }, + , + { + id: 15, + a: "sliderBarStyle", + b: "Object", + c: "null", + d: "Style applied to the base slider bar (useful for specifying color etc).", + }, + { + id: 16, + a: "activeBarStyle", + b: "Object", + c: "null", + d: "Style applied to the active slider bar (useful for specifying color etc).", + }, + { + id: 17, + a: "handleStyle", + b: "Object", + c: "null", + d: "Style applied to the slider handle (useful for specifying color etc).", + }, ], }} />