-
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.
- Loading branch information
1 parent
7b61c40
commit 37f5bb3
Showing
10 changed files
with
162 additions
and
188 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
91 changes: 0 additions & 91 deletions
91
src/OnboardingSPA/components/CardWithOptions/stylesheet.scss
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
src/OnboardingSPA/components/CardWithOptionsTemplate/CardWithOptions/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,28 @@ | ||
import { OptionItem } from '../'; | ||
import { memo } from '@wordpress/element'; | ||
|
||
const CardWithOptions = ( { title, options, selection, callback } ) => { | ||
const buildOptions = () => { | ||
return options.map( ( data, idx ) => { | ||
return ( | ||
<OptionItem | ||
key={ idx } | ||
idx={ idx } | ||
title={ data.title } | ||
desc={ data.desc } | ||
isSelected={ data.key === selection } | ||
callback={ callback } | ||
/> | ||
); | ||
} ); | ||
}; | ||
|
||
return ( | ||
<div className={ 'nfd-sg-card' }> | ||
<div className={ 'nfd-sg-card__title' }>{ title }</div> | ||
<div className={ 'nfd-sg-card__data' }>{ buildOptions() }</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default memo( CardWithOptions ); |
32 changes: 32 additions & 0 deletions
32
src/OnboardingSPA/components/CardWithOptionsTemplate/CardWithOptions/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,32 @@ | ||
$background-color: var(--nfd-onboarding-card-background); | ||
|
||
.nfd-sg-card { | ||
|
||
margin: 8px; | ||
max-width: 90vw; | ||
padding: 24px 16px; | ||
border-radius: 12px; | ||
background-color: $background-color; | ||
width: clamp(18.75rem, 22.6136rem + 5.6818vw, 31.25rem); | ||
box-shadow: 3px 3px 5px rgba(var(--nfd-onboarding-primary-rgb), $alpha: 0.05); | ||
|
||
@media (max-width: #{ ($break-large) }) { | ||
margin: 12px; | ||
padding: 12px 6px; | ||
} | ||
|
||
&__title { | ||
color: var(--nfd-onboarding-primary); | ||
margin: 16px; | ||
line-height: 1.5; | ||
font-size: 18px; | ||
text-align: center; | ||
margin-bottom: 30px; | ||
font-weight: 400; | ||
letter-spacing: 1.5; | ||
} | ||
|
||
&__data { | ||
margin: 12px; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/OnboardingSPA/components/CardWithOptionsTemplate/OptionItem/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,46 @@ | ||
import classNames from 'classnames'; | ||
import { memo } from '@wordpress/element'; | ||
import { Icon, chevronRight } from '@wordpress/icons'; | ||
|
||
const OptionItem = ( { idx, title, desc, isSelected, callback } ) => { | ||
return ( | ||
<div | ||
key={ idx } | ||
role="button" | ||
tabIndex={ 0 } | ||
className={ 'nfd-sg-card__data__option' } | ||
onClick={ () => { | ||
if ( callback && typeof callback === 'function' ) { | ||
callback( idx + 1 ); | ||
} | ||
} } | ||
onKeyDown={ () => { | ||
if ( callback && typeof callback === 'function' ) { | ||
callback( idx + 1 ); | ||
} | ||
} } | ||
> | ||
<div | ||
className={ classNames( | ||
'nfd-sg-card__data__option__wrapper', | ||
isSelected && 'nfd-sg-card__data__option__wrapper--selected' | ||
) } | ||
> | ||
<div className={ 'nfd-sg-card__data__option__left' }> | ||
<div className={ 'nfd-sg-card__data__option__left_top' }> | ||
{ title } | ||
</div> | ||
<div className={ 'nfd-sg-card__data__option__left_bottom' }> | ||
{ desc } | ||
</div> | ||
</div> | ||
<Icon | ||
className={ 'nfd-sg-card__data__option__right' } | ||
icon={ chevronRight } | ||
/> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default memo( OptionItem ); |
47 changes: 47 additions & 0 deletions
47
src/OnboardingSPA/components/CardWithOptionsTemplate/OptionItem/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,47 @@ | ||
$background-color: var(--nfd-onboarding-card-background); | ||
|
||
.nfd-sg-card__data__option { | ||
|
||
&__wrapper { | ||
display: flex; | ||
cursor: pointer; | ||
margin: 16px 4px; | ||
align-items: center; | ||
border-radius: 8px; | ||
padding: 16px 12px 16px 12px; | ||
justify-content: space-between; | ||
transition: background-color 400ms ease-in-out; | ||
|
||
&--selected { | ||
background-color: var(--nfd-onboarding-hover); | ||
} | ||
} | ||
|
||
&:not(:last-child) { | ||
border-bottom: 0.5px solid rgba(var(--nfd-onboarding-primary-rgb), 0.3); | ||
} | ||
|
||
&__left_top { | ||
color: var(--nfd-onboarding-primary); | ||
font-size: 15px; | ||
font-weight: 500; | ||
margin-bottom: 7px; | ||
line-height: 24px; | ||
} | ||
|
||
&__left_bottom { | ||
color: rgba(var(--nfd-onboarding-primary-rgb), 0.7); | ||
|
||
font-size: 14px; | ||
font-weight: 300; | ||
} | ||
|
||
&__right { | ||
fill: var(--nfd-onboarding-primary); | ||
transition: all 200ms ease-in-out; | ||
|
||
&:hover { | ||
transform: scale(1.1); | ||
} | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
src/OnboardingSPA/components/CardWithOptionsTemplate/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,2 @@ | ||
export { default as OptionItem } from './OptionItem'; | ||
export { default as CardWithOptions } from './CardWithOptions'; |
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