-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(app): Make toggle components reusable (#1675)
Group toggle button, labeled toggle, and toggle info for resuse in app and robot settings
- Loading branch information
Showing
16 changed files
with
131 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
// @flow | ||
import * as React from 'react' | ||
|
||
import styles from './styles.css' | ||
import {ToggleInfo} from '../toggles' | ||
|
||
// TODO(mc, 2018-05-30): "Read full policy" link at end of first paragraph | ||
export default function AnalyticsInfo () { | ||
return ( | ||
<div className={styles.analytics_info}> | ||
<ToggleInfo> | ||
<p> | ||
Help Opentrons improve its products and services by automatically sending anonymous diagnostic and usage data. | ||
</p> | ||
<p> | ||
This will allow us to learn things such as which features get used the most, which parts of the process are taking longest to complete, and how errors are generated. You can change this setting at any time. | ||
</p> | ||
</div> | ||
</ToggleInfo> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nents/analytics-settings/LabeledToggle.js → app/src/components/toggles/LabeledToggle.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// @flow | ||
import * as React from 'react' | ||
|
||
import styles from './styles.css' | ||
|
||
type Props = { | ||
children: React.Node | ||
} | ||
export default function ToggleInfo (props: Props) { | ||
return ( | ||
<div className={styles.toggle_info}> | ||
{props.children} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// @flow | ||
import ToggleButton from './ToggleButton' | ||
import LabeledToggle from './LabeledToggle' | ||
import ToggleInfo from './ToggleInfo' | ||
|
||
export {ToggleButton, LabeledToggle, ToggleInfo} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
@import '@opentrons/components'; | ||
|
||
/* Toggle Button */ | ||
.toggled_on { | ||
fill: #0ec9eb; | ||
color: #0ec9eb; | ||
} | ||
|
||
.toggled_off { | ||
fill: var(--c-dark-gray); | ||
} | ||
|
||
/* Labeled Toggle */ | ||
.labeled_toggle { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
width: 100%; | ||
margin-top: 0.5rem; | ||
} | ||
|
||
.labeled_toggle_label { | ||
@apply --font-body-1-dark; | ||
|
||
font-weight: var(--fw-semibold); | ||
} | ||
|
||
.labeled_toggle_button { | ||
flex: none; | ||
width: 2rem; | ||
margin-right: 1rem; | ||
padding: 0; | ||
|
||
&:hover { | ||
background-color: transparent; | ||
} | ||
} | ||
|
||
/* Toggle Info */ | ||
.toggle_info { | ||
@apply --font-body-1-dark; | ||
|
||
max-width: 25rem; | ||
|
||
& > p { | ||
margin: 1rem 0; | ||
line-height: 1.5; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters