Skip to content

Commit

Permalink
fix: handle dashing in button field variant for now
Browse files Browse the repository at this point in the history
  • Loading branch information
julrich committed Jul 13, 2021
1 parent 435af0d commit 5231194
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
11 changes: 7 additions & 4 deletions example/content/landingpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ sections:
- mode: default
spaceBefore: default
width: default
background: default
background: dark
headline:
level: h2
align: center
Expand All @@ -431,38 +431,41 @@ sections:
amet.
link:
label: Lorem Ipsum
variant: solid
variant: outline_inverted
size: medium
href: https://example.com
type: link-button
image: https://picsum.photos/seed/kdsteaserbox/500/300
ratio: VALUE_16_9
darkStyle: true
- type: teaser-box
topic: Lorem Ipsum
text: Lorem ipsum dolor sit amet, consectetur adipisicing elit. Lorem ispum
dolor distinctio minima unde voluptatum aut. Lorem ipsum dolor sit
amet.
link:
label: Lorem Ipsum
variant: solid
variant: outline_inverted
size: medium
href: https://example.com
type: link-button
image: https://picsum.photos/seed/kdsteaserbox/500/300
ratio: VALUE_16_9
darkStyle: true
- type: teaser-box
topic: Lorem Ipsum
text: Lorem ipsum dolor sit amet, consectetur adipisicing elit. Lorem ispum
dolor distinctio minima unde voluptatum aut. Lorem ipsum dolor sit
amet.
link:
label: Lorem Ipsum
variant: solid
variant: outline_inverted
size: medium
href: https://example.com
type: link-button
image: https://picsum.photos/seed/kdsteaserbox/500/300
ratio: VALUE_16_9
darkStyle: true
type: sections
gutter: default
type: page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ const cleanObjectKeys = (obj) => {
}
} else if (obj[property]) {
if (obj[property] !== null) {
cleanedObject[cleanFieldName(property)] = obj[property];
// TODO re-simplify this... only needed because of inconsistent handling of `-` vs `_` in schema enum values
if (cleanFieldName(property) === 'variant') {
cleanedObject[cleanFieldName(property)] = obj[property].replace('_', '-');
} else {
cleanedObject[cleanFieldName(property)] = obj[property];
}
}
}
}
Expand All @@ -54,7 +59,6 @@ const cleanObjectKeys = (obj) => {
};

const getComponent = (element, isSection = false) => {
console.log(element['type'], element);
const componentType = isSection ? 'section' : element['type'];

componentCounter[componentType] = componentCounter[componentType]+1 || 1;
Expand Down

0 comments on commit 5231194

Please # to comment.