-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add success animation to security key and TOTP flows (#227)
* Clear notices when moving through webauthn flow * Add success animation to end of register key flow * Reuse success animation for totp
- Loading branch information
1 parent
72575f2
commit 9dd67ca
Showing
6 changed files
with
146 additions
and
68 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { useState } from '@wordpress/element'; | ||
import { Icon, check } from '@wordpress/icons'; | ||
|
||
/** | ||
* Render the "Success" component. | ||
* | ||
* Shows a message and animation, then calls the `afterTimeout` callback | ||
* | ||
* @param props | ||
* @param props.afterTimeout | ||
* @param props.message | ||
*/ | ||
export default function Success( { message, afterTimeout } ) { | ||
const [ hasTimer, setHasTimer ] = useState( false ); | ||
|
||
if ( ! hasTimer ) { | ||
// Time matches the length of the CSS animation property on .wporg-2fa__success | ||
setTimeout( afterTimeout, 4000 ); | ||
setHasTimer( true ); | ||
} | ||
|
||
return ( | ||
<> | ||
<p className="wporg-2fa__screen-intro">{ message }</p> | ||
|
||
<p className="wporg-2fa__webauthn-register-key-status" aria-hidden> | ||
<div className="wporg-2fa__success"> | ||
<Icon icon={ check } /> | ||
</div> | ||
</p> | ||
</> | ||
); | ||
} |
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,29 @@ | ||
@keyframes success { | ||
0% { | ||
transform: scale(0); | ||
} | ||
10% { | ||
transform: scale(1.5); | ||
} | ||
20% { | ||
transform: scale(1); | ||
} | ||
80% { | ||
transform: scale(1); | ||
} | ||
100% { | ||
transform: scale(0); | ||
} | ||
} | ||
|
||
.wporg-2fa__success { | ||
transform: scale(0); | ||
background: #33F078; | ||
border-radius: 50%; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
width: 32px; | ||
height: 32px; | ||
animation: success 4s ease-in-out; | ||
} |
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