Skip to content

Commit

Permalink
Fix vertical accordion activation
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusd committed Nov 30, 2018
1 parent 6b1413e commit f5cd803
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 18 deletions.
2 changes: 1 addition & 1 deletion app/components/SideBar/MenuLinks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class MenuLinks extends React.Component {

return (
<Aux>
{linkList.map(link => this.getMenuLink(link))}
{this.links.map(link => this.getMenuLink(link))}
{caret}
</Aux>
);
Expand Down
34 changes: 19 additions & 15 deletions app/components/views/TrezorPage/ChangeLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { KeyBlueButton } from "buttons";
class ChangeLabel extends React.Component {
constructor(props) {
super(props);
this.state = { newLabel: "" };
this.state = { newLabel: "", show: false };
}

onChangeLabelClicked() {
Expand All @@ -18,6 +18,10 @@ class ChangeLabel extends React.Component {
this.setState({ newLabel: e.target.value });
}

onToggleAccordion() {
this.setState({ show: !this.state.show });
}

render() {

const changeLabelHeader = (
Expand All @@ -32,22 +36,22 @@ class ChangeLabel extends React.Component {
<VerticalAccordion
height={100}
header={changeLabelHeader}
show={this.state.show}
onToggleAccordion={this.onToggleAccordion}
className="trezor-config-accordion"
>
<Aux>
<div><T id="trezor.changeLabel.description" m="New Label" /></div>
<div>
<TextInput
value={this.state.newLabel}
onChange={this.onNewLabelChanged}
/>
</div>
<div>
<KeyBlueButton onClick={this.onChangeLabelClicked} disabled={loading} loading={loading} >
<T id="trezor.changeLabel.changeButton" m="Change" />
</KeyBlueButton>
</div>
</Aux>
<div><T id="trezor.changeLabel.description" m="New Label" /></div>
<div>
<TextInput
value={this.state.newLabel}
onChange={this.onNewLabelChanged}
/>
</div>
<div>
<KeyBlueButton onClick={this.onChangeLabelClicked} disabled={loading} loading={loading} >
<T id="trezor.changeLabel.changeButton" m="Change" />
</KeyBlueButton>
</div>
</VerticalAccordion>

);
Expand Down
9 changes: 8 additions & 1 deletion app/components/views/TrezorPage/ConfigButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import { KeyBlueButton } from "buttons";
class ConfigButtons extends React.Component {
constructor(props) {
super(props);
this.state = { show: false };
}

onToggleAccordion() {
this.setState({ show: !this.state.show });
}

render() {
Expand All @@ -21,8 +26,10 @@ class ConfigButtons extends React.Component {

return (
<VerticalAccordion
height={75}
height={105}
header={ConfigButtonsHeader}
show={this.state.show}
onToggleAccordion={this.onToggleAccordion}
className="trezor-config-accordion trezor-config-regular-buttons"
>
<KeyBlueButton onClick={onTogglePinProtection} loading={loading} disabled={loading}>
Expand Down
8 changes: 7 additions & 1 deletion app/components/views/TrezorPage/FirmwareUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { PathBrowseInput } from "inputs";
class FirmwareUpdate extends React.Component {
constructor(props) {
super(props);
this.state = { path: "" };
this.state = { path: "", show: false };
}

onChangePath(path) {
Expand All @@ -19,6 +19,10 @@ class FirmwareUpdate extends React.Component {
this.props.onUpdateFirmware(this.state.path);
}

onToggleAccordion() {
this.setState({ show: !this.state.show });
}

render() {

const header = (
Expand All @@ -33,6 +37,8 @@ class FirmwareUpdate extends React.Component {
<VerticalAccordion
height={250}
header={header}
show={this.state.show}
onToggleAccordion={this.onToggleAccordion}
className="trezor-config-accordion trezor-config-regular-buttons"
>
<div className="trezor-wipe-warning">
Expand Down
7 changes: 7 additions & 0 deletions app/components/views/TrezorPage/RecoveryButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import { Documentation } from "shared";
class RecoveryButtons extends React.Component {
constructor(props) {
super(props);
this.state = { show: false };
}

onToggleAccordion() {
this.setState({ show: !this.state.show });
}

render() {
Expand All @@ -23,6 +28,8 @@ class RecoveryButtons extends React.Component {
<VerticalAccordion
height={250}
header={header}
show={this.state.show}
onToggleAccordion={this.onToggleAccordion}
className="trezor-config-accordion trezor-config-regular-buttons"
>
<div className="trezor-wipe-warning">
Expand Down

0 comments on commit f5cd803

Please sign in to comment.