Skip to content

Commit

Permalink
Secondary Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
officiallygod committed Apr 28, 2023
1 parent c458108 commit 0902969
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
3 changes: 2 additions & 1 deletion build/1.4.1/onboarding.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/1.4.1/onboarding.css.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const StepPrimarySetup = () => {
const contents = getContents();
const defaultPrimaryType = 'business';
const [ siteClassData, setSiteClassData ] = useState();
const [ primaryTypeList, setPrimaryTypeList ] = useState();
const [ primaryType, changePrimaryType ] = useState( defaultPrimaryType );
const [ secondaryType, changeSecondaryType ] = useState( '' );
const [ inputCategVal, changeInputCateg ] = useState( '' );
Expand All @@ -51,7 +52,11 @@ const StepPrimarySetup = () => {
*/
const getSiteClassificationsData = async () => {
const siteClassificationsData = await getSiteClassifications();

setSiteClassData( siteClassificationsData?.body );
setPrimaryTypeList(
Object.keys( siteClassificationsData?.body?.types )
);

if ( currentData?.data?.siteType?.primary !== '' )
changePrimaryType( currentData?.data?.siteType?.primary );
Expand Down Expand Up @@ -93,6 +98,22 @@ const StepPrimarySetup = () => {
setCurrentOnboardingData( currentDataCopy );
};

const changePrimaryPrev = () => {
const idx = primaryTypeList.findIndex( ( val ) => primaryType === val );

if ( idx === 0 )
changePrimaryType( primaryTypeList[ primaryTypeList.length - 1 ] );
else changePrimaryType( primaryTypeList[ idx - 1 ] );
};

const changePrimaryNext = () => {
const idx = primaryTypeList.findIndex( ( val ) => primaryType === val );

if ( idx === primaryTypeList.length - 1 )
changePrimaryType( primaryTypeList[ 0 ] );
else changePrimaryType( primaryTypeList[ idx + 1 ] );
};

const secondarySiteTypeChips = () => {
const secondaryChipList = [];

Expand Down Expand Up @@ -138,9 +159,11 @@ const StepPrimarySetup = () => {
{ siteClassData && (
<div className="category-scrolling-wrapper">
<div className="category-scrolling-wrapper_left-btn">
{ /* eslint-disable-next-line jsx-a11y/no-static-element-interactions */ }
<span
className="category-scrolling-wrapper_left-btn-icon"
onClick={ () => {} }
onClick={ changePrimaryPrev }
onKeyUp={ changePrimaryPrev }
style={ {
backgroundImage:
'var(--chevron-left-icon)',
Expand All @@ -164,9 +187,11 @@ const StepPrimarySetup = () => {
</p>
</div>
<div className="category-scrolling-wrapper_right-btn">
{ /* eslint-disable-next-line jsx-a11y/no-static-element-interactions */ }
<span
className="category-scrolling-wrapper_right-btn-icon"
onClick={ () => {} }
onClick={ changePrimaryNext }
onKeyUp={ changePrimaryNext }
style={ {
backgroundImage:
'var(--chevron-right-icon)',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
}

.subCategoriesSection {
height: 25vh;
margin-top: 1rem;
margin-bottom: 1rem;
}
Expand Down

0 comments on commit 0902969

Please sign in to comment.