-
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.
Merge pull request #138 from newfold-labs/PRESS-2-458-Loader-for-Radi…
…o-Label-controls Press 2 458 Loader for Radio label controls
- Loading branch information
Showing
12 changed files
with
175 additions
and
70 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
src/OnboardingSPA/components/RadioControl/RadioControlSkeleton/index.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,14 @@ | ||
/** | ||
* Renders Skeletons for Radio Control. | ||
* | ||
* @param {number} options The options to be renedered | ||
* | ||
*/ | ||
const RadioControlSkeleton = ({ options }) => { | ||
|
||
return <div className="radio-control-skeleton"> | ||
{options.map((option) => (<div className="radio-control-skeleton-item" />))} | ||
</div>; | ||
}; | ||
|
||
export default RadioControlSkeleton; |
22 changes: 22 additions & 0 deletions
22
src/OnboardingSPA/components/RadioControl/RadioControlSkeleton/stylesheet.scss
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,22 @@ | ||
/*COLOR VARIABLES*/ | ||
$white-offset: rgb(224, 224, 224); | ||
$main-color-light: var(--nfd-onboarding-white); | ||
|
||
.radio-control { | ||
|
||
&-main { | ||
animation: fadeIn 300ms ease-in; | ||
} | ||
|
||
&-skeleton { | ||
margin: 30px; | ||
|
||
&-item { | ||
height: 32px; | ||
margin: 12px; | ||
padding: 10px; | ||
background: transparent; | ||
} | ||
} | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
src/OnboardingSPA/components/RadioControl/RadioControlStateHandler/index.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,27 @@ | ||
import { useState, useEffect } from '@wordpress/element'; | ||
import RadioControlSkeleton from '../RadioControlSkeleton'; | ||
|
||
/** | ||
* A State Handler to manage Radio Control | ||
* | ||
* @param {number} options The options to be renedered. | ||
* @param {string} children The children to be rendered out. | ||
* @param {number} watch The variable to be awaited for to be fetched. | ||
* | ||
*/ | ||
const RadioControlStateHandler = ({ options, watch, children }) => { | ||
const [rerender, doRerender] = useState(0); | ||
|
||
useEffect(() => doRerender(1), [watch]); | ||
|
||
return !watch ? ( | ||
<RadioControlSkeleton options={options} /> | ||
) : ( | ||
<> | ||
{<div style={{ display: 'none' }}>{rerender}</div>} | ||
{children} | ||
</> | ||
); | ||
}; | ||
|
||
export default RadioControlStateHandler; |
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,2 @@ | ||
export { default as RadioControlSkeleton } from './RadioControlSkeleton'; | ||
export { default as RadioControlStateHandler } from './RadioControlStateHandler'; |
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
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