Skip to content

Commit 7367f9c

Browse files
authored
Merge pull request #2191 from lumada-design/feat/5637
chore: fix storybook. HVUIKIT-5637
2 parents ebdfb52 + 1ca0510 commit 7367f9c

File tree

5 files changed

+11
-2
lines changed

5 files changed

+11
-2
lines changed

.storybook/blocks/ArgsTable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const getComponent = (props = {}, context) => {
1313
const { parameters = {} } = context;
1414
const { component } = parameters;
1515
if (isShortcut(of) || isShortcut(story)) {
16-
return component.Naked || component || null;
16+
return component?.Naked || component || null;
1717
}
1818
if (!of) {
1919
throw new Error(ArgsTableError.NO_COMPONENT);

.storybook/preview-body.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<style>
2+
.sb-show-main.sb-main-padded {
3+
margin: 10px;
4+
padding: 0;
5+
}
6+
</style>

.storybook/preview.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import DocsContainer from "./blocks/DocsContainer";
66
import { getTheme, UIKIT_THEME } from "./theme";
77
import { extractArgTypes } from "./props/extractArgTypes";
88
import storySort from "./story_store/storySort";
9+
import "./theme/fonts/font-faces.css";
910

1011
export const parameters = {
1112
actions: { argTypesRegex: "^on[A-Z].*" },

.storybook/props/extractProps.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ export const extractProps = (component) => {
5656
// wrapped withStyles or withLabels or withId
5757
// shouldn't be needed because we are https://reactjs.org/docs/higher-order-components.html#static-methods-must-be-copied-over
5858
return extractProps(component.Naked);
59+
} else if (isForwardRef(component) || component.render) {
60+
return extractProps(component.render().type);
5961
} else if (isMemo(component)) {
6062
return extractProps(component.type().type);
6163
}

.storybook/theme/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const getTheme = (theme) => {
1616
if (isEyesStorybook) {
1717
// if being tested, don't rely on the stored theme but instead on the variation url parameter
1818
const eyesVariation = new URL(window.location).searchParams.get("eyes-variation");
19-
const eyesTheme = eyesVariation.split(":")?.[1];
19+
const eyesTheme = eyesVariation?.split(":")?.[1];
2020

2121
return themes?.[eyesTheme] || themes?.[DEFAULT_THEME];
2222
}

0 commit comments

Comments
 (0)