Skip to content

Commit

Permalink
♻️ Refactor Code and styles
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeltomasik committed Mar 26, 2018
1 parent 8442719 commit 819adca
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 21 deletions.
1 change: 0 additions & 1 deletion i18n/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
" Make sure that you are using the latest version of Lisk Hub.": " Make sure that you are using the latest version of Lisk Hub.",
"About": "About",
"Account initialization": "Account initialization",
"Account locked!": "Account locked!",
"Activity": "Activity",
"Add": "Add",
"Add a Lisk ID": "Add a Lisk ID",
Expand Down
4 changes: 2 additions & 2 deletions src/components/copyToClipboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ class CopyToClipboard extends React.Component {
return (
<ReactCopyToClipboard text={value} onCopy={() => this.textIsCopied()}>
{this.state.copied ? <span className={`${className} copied`}>
{t('Copied!')} <FontIcon value='copy-to-clipboard' className={copyClassName}></FontIcon>
<FontIcon value='copy-to-clipboard' className={copyClassName}></FontIcon> {t('Copied!')}
</span> :
<span className={`${className} ${styles.clickable} default`}>
<span className='copy-title'>{text || value}</span>
<FontIcon value='copy-to-clipboard' className={copyClassName}></FontIcon>
<span className='copy-title'>{text || value}</span>
</span>
}
</ReactCopyToClipboard>
Expand Down
2 changes: 1 addition & 1 deletion src/components/copyToClipboard/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('CopyToClipboard', () => {
});

it('should click on span.default render "Copied!"', () => {
const expectValue = 'Copied! ';
const expectValue = ' Copied!';
wrapper.find('span.default').simulate('click');
expect(wrapper.find('span.copied').text()).to.be.equal(expectValue);
});
Expand Down
11 changes: 5 additions & 6 deletions src/components/header/customCountDown.css
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
.reset {
margin-right: 10px;
padding: 0px 3px;
padding-left: 3px;
padding-right: 3px;
padding-bottom: 5px;
cursor: pointer;
color: white;
border-bottom: solid 2px white;
display: inline;

&:hover {
transition: all 0.3 ease-out;
transform: scale(1.1);
}
}

.timeout {
color: red;
font-weight: 600;
font-size: 13px;
}

.timerRow {
Expand Down
4 changes: 2 additions & 2 deletions src/components/header/customCountDown.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const CustomCountDown = ({ minutes, autoLog, seconds, resetTimer, t }) => {
const min = minutes < 10 ? `0${minutes}` : minutes;
const sec = seconds < 10 ? `0${seconds}` : seconds;

const resetCondition = (minutes <= 9 && seconds <= 50);
const timeoutCondition = (minutes <= 5 && seconds <= 0);
const resetCondition = (minutes < 5);
const timeoutCondition = (minutes === 0 && seconds === 0);

const resetButton = resetCondition && !timeoutCondition ? <div onClick={() => {
resetTimer();
Expand Down
22 changes: 20 additions & 2 deletions src/components/header/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
}
}

.unlocked {
color: red;
font-weight: 600;
font-size: 13px;
line-height: 1.1em; /* stylelint-disable-line */
}

.logoWrapper {
width: 25%;
}
Expand Down Expand Up @@ -120,18 +127,29 @@
height: var(--avatar-height);

& .balance {
font-size: var(--font-size-normal);
font-size: 29px;
color: var(--color-white);
line-height: 0.5em; /* stylelint-disable-line */
padding-top: 7px;

& small {
font-size: var(--font-size-small);
}
}

& .address {
font-size: var(--font-size-normal);
font-size: var(--font-size-small);
color: var(--color-grayscale-medium);
}

& .copy {
font-size: var(--font-size-normal);
}

& .timer {
font-size: var(--font-size-small);
color: var(--color-grayscale-medium);
line-height: 1.1em; /* stylelint-disable-line */
}
}

Expand Down
14 changes: 7 additions & 7 deletions src/components/header/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ class Header extends React.Component {
<LiskAmount val={this.props.account.balance}/>
<small> LSK</small>
</div>
<CopyToClipboard value={this.props.account.address} className={`${styles.address} account-information-address`}/>
<CopyToClipboard
value={this.props.account.address}
className={`${styles.address} account-information-address`}
copyClassName={styles.copy}/>
{!this.props.autoLog && this.props.account.passphrase ?
<div className={styles.unlocked}>{this.props.t('Unlocked')}</div> : <div></div>}
{this.props.autoLog ? <div className={styles.timer}>
{((this.props.account.expireTime &&
this.props.account.expireTime !== 0) &&
Expand All @@ -69,12 +74,7 @@ class Header extends React.Component {
</Countdown>
</div> : <div></div>}
</div>
: <div className={styles.timer}>
{this.props.account.passphrase ? '' : <span>
<FontIcon value='locked' className={styles.lock}/> {this.props.t('Account locked!')}
</span>
}
</div>
: <div></div>
}
</div>
<Link to={`${routes.accounts.path}`} className={styles.avatar}>
Expand Down

0 comments on commit 819adca

Please sign in to comment.