Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
feat(password): upgrade with icon (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyncee59 authored and Méril committed Jan 11, 2019
1 parent 062f0fb commit 8439a79
Show file tree
Hide file tree
Showing 2 changed files with 339 additions and 49 deletions.
16 changes: 9 additions & 7 deletions src/Atoms/Inputs/Password.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import styled, { type ReactComponentFunctional } from 'styled-components'

import { fontSize, theme } from '../../Tools/interpolation'
import Input, { type PropsType, type HtmlInputType } from './Input'
import { FarEye, FarEyeSlash } from '../Icons'

const Switch = styled.span`
position: absolute;
right: 1.25rem;
bottom: 0.875rem;
cursor: pointer;
right: 1rem;
bottom: 0.5rem;
font-family: ${theme('fontPrimary')};
font-size: ${fontSize('xs')};
font-weight: 600;
Expand All @@ -19,13 +19,11 @@ const Switch = styled.span`
text-decoration: underline;
}
`

const PasswordInput: ReactComponentFunctional<PropsType> = styled(Input)`
input {
padding-right: 3.5rem;
padding-right: 3rem;
}
`

type StateType = {| type: HtmlInputType |}

class Password extends React.Component<PropsType, StateType> {
Expand All @@ -50,7 +48,11 @@ class Password extends React.Component<PropsType, StateType> {

return (
<Switch onClick={this.handleSwitchClick}>
{this.state.type === 'password' ? 'Show' : 'Hide'}
{this.state.type === 'password' ? (
<FarEye selectable size="20px" />
) : (
<FarEyeSlash selectable size="20px" />
)}
</Switch>
)
}
Expand Down
Loading

0 comments on commit 8439a79

Please sign in to comment.