Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change styles to allow SettingsListControl to support wider controls #1617

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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