Skip to content

Commit

Permalink
chore(typography): add fallback sizes for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
castastrophe committed Oct 4, 2024
1 parent 31442c4 commit 161fc46
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions components/typography/stories/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,28 @@ export const Template = (args = {}, context = {}) => {
return Template({ ...args, ...c }, context);
}

// body doesn't come in xxs, but if paired with an xxs heading, use xs (the closest size to xxs)
if (semantics === "body" && size === "xxs") {
size = "xs";
switch(size) {
case "xxs":
// Neither code nor body support xxs, but if paired with an xxs heading, use xs (the closest size to xxs)
if (["body", "code"].includes(semantics)) {
size = "xs";
}
break;
case "xs":
if (["detail"].includes(semantics)) {
size = "s";
}
break;
case "xxl":
if (["detail", "code"].includes(semantics)) {
size = "xl";
}
break;
case "xxxl":
if (["detail", "code"].includes(semantics)) {
size = "xl";
}
break;
}

if (typeof semantics === "undefined") {
Expand Down

0 comments on commit 161fc46

Please sign in to comment.