This repository has been archived by the owner on May 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(demo): Expandable, optional.mandatory knobs - FRONT-1021 (#399)
- Loading branch information
Showing
4 changed files
with
64 additions
and
44 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,21 @@ | ||
const adapter = initialData => { | ||
// Copy reference specification demo adaptedData. | ||
const adaptedData = JSON.parse(JSON.stringify(initialData)); | ||
adaptedData.label_expanded = adaptedData.labelExpanded; | ||
adaptedData.label_collapsed = adaptedData.labelCollapsed; | ||
delete adaptedData.labelExpanded; | ||
delete adaptedData.labelCollapsed; | ||
adaptedData.extra_dropdown_classes = 'ecl-u-type-paragraph-m'; | ||
adaptedData.button.icon = { | ||
path: '/icons.svg', | ||
}; | ||
// Delete everything that is unneeded for our component to | ||
// be properly rendered when we have the values in the template. | ||
delete adaptedData.button.icon.shape; | ||
delete adaptedData.button.variant; | ||
delete adaptedData.button.label; | ||
|
||
return adaptedData; | ||
}; | ||
|
||
export default adapter; |
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 |
---|---|---|
@@ -1,24 +1,4 @@ | ||
/* eslint-disable import/no-extraneous-dependencies, no-param-reassign */ | ||
import specData from '@ecl/ec-specs-expandable/demo/data'; | ||
import specs from '@ecl/ec-specs-expandable/demo/data'; | ||
import adapter from '../adapter'; | ||
|
||
const adapter = initialData => { | ||
// Copy reference specification demo data. | ||
const adaptedData = JSON.parse(JSON.stringify(initialData)); | ||
|
||
adaptedData.label_expanded = adaptedData.labelExpanded; | ||
adaptedData.label_collapsed = adaptedData.labelCollapsed; | ||
adaptedData.extra_dropdown_classes = 'ecl-u-type-paragraph-m'; | ||
|
||
const [type, name] = adaptedData.button.icon.shape.split('--'); | ||
|
||
adaptedData.button.icon = { | ||
type, | ||
name, | ||
path: '/icons.svg', | ||
...adaptedData.button.icon, | ||
}; | ||
|
||
return adaptedData; | ||
}; | ||
|
||
export default adapter(specData); | ||
export default adapter(specs); |
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