Skip to content

Commit

Permalink
Merge pull request #1617 from SammyIsConfused/bugfix/allow_wider_cont…
Browse files Browse the repository at this point in the history
…rols_in_settings_list

Change styles to allow SettingsListControl to support wider controls
  • Loading branch information
SammyIsConfused authored Apr 20, 2020
2 parents d3b2436 + 0f3f5ae commit abb4646
Show file tree
Hide file tree
Showing 4 changed files with 1,403 additions and 363 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import * as React from "react";
import { boolean, number, text } from "@storybook/addon-knobs";
import SettingsListControl from "../../tsrc/components/SettingsListControl";
import SettingsToggleSwitch from "../../tsrc/components/SettingsToggleSwitch";
import { Mark, Slider } from "@material-ui/core";
import { action } from "@storybook/addon-actions";

export default {
title: "SettingsListControl",
component: SettingsListControl
};

const marks: Mark[] = [
{ label: "Off", value: 0 },
{ label: "x0.25", value: 1 },
{ label: "x0.5", value: 2 },
{ label: "No boost", value: 3 },
{ label: "x1.5", value: 4 },
{ label: "x2", value: 5 },
{ label: "x4", value: 6 },
{ label: "x8", value: 7 }
];

export const ToggleSwitchControl = () => (
<SettingsListControl
secondaryText={text("Secondary Text", "Box for checking")}
control={
<SettingsToggleSwitch
disabled={boolean("Disabled", false)}
id={"toggle"}
setValue={action("Value of checkbox changed")}
value={boolean("Toggle state", false)}
/>
}
divider={boolean("divider", false)}
primaryText={text("primaryText", "Checkbox")}
/>
);
export const SliderControl = () => (
<SettingsListControl
secondaryText={text("Secondary Text", "Slide for sliding")}
control={
<Slider
marks={marks}
onChangeCommitted={action("Value of slider changed")}
min={number("min", 0)}
max={number("max", 7)}
step={null}
/>
}
divider={boolean("divider", false)}
primaryText={text("primaryText", "SliderControl")}
/>
);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SearchSettingFormControl from "../../components/SearchSettingFormControl";
import SearchSettingFormControl from "../../../tsrc/components/SearchSettingFormControl";
import { TextField } from "@material-ui/core";
import * as React from "react";
import { mount, ReactWrapper, shallow } from "enzyme";
Expand Down
Loading

0 comments on commit abb4646

Please sign in to comment.