This repository has been archived by the owner on Aug 21, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
8,545 additions
and
7,407 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# VerificationCode | ||
|
||
A special type of input specifically designed for entering 2FA codes | ||
|
||
## Example | ||
|
||
```jsx | ||
<VerificationCode /> | ||
``` | ||
|
||
## Props | ||
|
||
| Prop | Type | Default | Description | | ||
| ------------- | ---------- | ------- | -------------------------------------------------------- | | ||
| code | `string` | `''` | If you need to assign a value externally, use this prop. | | ||
| isValid | `boolean` | `true` | Gives the field invalid stylings | | ||
| numberOfChars | `number` | `6` | If you need more or less number of characters | | ||
| onEnter | `function` | `noop` | To get the current value on enter press | | ||
| onChange | `function` | `noop` | To get the current value on change | |
125 changes: 125 additions & 0 deletions
125
src/components/VerificationCode/VerificationCode.css.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
import styled from '../styled' | ||
import { getColor, rgba } from '../../styles/utilities/color' | ||
import Icon from '../Icon' | ||
import Tooltip from '../Tooltip' | ||
|
||
export const VerificationCodeFieldUI = styled('div')` | ||
box-sizing: border-box; | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: nowrap; | ||
justify-content: center; | ||
align-items: center; | ||
position: relative; | ||
width: 500px; | ||
height: 74px; | ||
border: 1px solid #c5ced6; | ||
border-radius: 3px; | ||
background-color: #fff; | ||
box-shadow: 0 0 0 0 ${rgba(getColor('border'), 0)}; | ||
transition: box-shadow 100ms ease, border-color 100ms ease; | ||
*, | ||
*:before, | ||
*:after { | ||
box-sizing: inherit; | ||
} | ||
&:focus { | ||
outline: none; | ||
} | ||
&:focus-within { | ||
border-color: transparent; | ||
box-shadow: 0 0 0 2px ${getColor('blue.500')}; | ||
} | ||
&.not-valid { | ||
border-color: transparent; | ||
box-shadow: 0 0 0 2px #f23459; | ||
} | ||
` | ||
|
||
export const DigitInputWrapperUI = styled('div')` | ||
position: relative; | ||
margin: 0 15px 0 0; | ||
&:last-of-type { | ||
margin-right: 0; | ||
} | ||
` | ||
|
||
export const DigitMaskUI = styled('div')` | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 40px; | ||
height: 50px; | ||
padding: 0 0 7px 0; | ||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, | ||
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; | ||
font-size: 35px; | ||
line-height: 41px; | ||
text-align: center; | ||
color: ${getColor('charcoal.700')}; | ||
border-bottom: 2px solid #d5dce1; | ||
-webkit-font-smoothing: antialiased; | ||
&::selection { | ||
background-color: #b2d7ff; | ||
} | ||
&.hidden { | ||
opacity: 0; | ||
} | ||
` | ||
|
||
export const DigitInputUI = styled('input')` | ||
position: relative; | ||
width: 40px; | ||
height: 50px; | ||
padding: 0 0 7px 0; | ||
margin: 0; | ||
border: 0; | ||
border-bottom: 2px solid #d5dce1; | ||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, | ||
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; | ||
font-size: 35px; | ||
line-height: 35px; | ||
text-align: center; | ||
color: ${getColor('charcoal.700')}; | ||
-webkit-font-smoothing: antialiased; | ||
&:focus { | ||
outline: none; | ||
border-bottom-color: ${getColor('blue.500')}; | ||
} | ||
&::selection { | ||
background-color: #b2d7ff; | ||
} | ||
&.hidden { | ||
opacity: 0; | ||
} | ||
` | ||
|
||
export const ClipboardPlaceholderUI = styled('textarea')` | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
opacity: 0; | ||
pointer-events: none; | ||
width: 1px; | ||
height: 1px; | ||
` | ||
|
||
export const ValidIconUI = styled(Tooltip)` | ||
position: absolute; | ||
right: 8px; | ||
top: calc(50% - 24px / 2); | ||
` | ||
|
||
export const IconUI = styled(Icon)` | ||
color: #f23459; | ||
` |
Oops, something went wrong.