Skip to content

Commit 390c2da

Browse files
authored
feat(stylelint,storybook): fixed styleling misconfig and fixed storybooks (#5281)
1 parent ffa9a3e commit 390c2da

File tree

8 files changed

+502
-566
lines changed

8 files changed

+502
-566
lines changed

.storybook/constants.ts renamed to .storybook/constants.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,4 @@ const nodeVersionData = {
3232
],
3333
};
3434

35-
export const pageProps = {
36-
i18nData,
37-
nodeVersionData,
38-
};
35+
export const pageProps = { i18nData, nodeVersionData };

.storybook/main.js renamed to .storybook/main.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
/** @type { import('@storybook/nextjs').StorybookConfig } */
2-
const config = {
1+
import type { StorybookConfig } from '@storybook/nextjs';
2+
3+
const config: StorybookConfig = {
34
stories: ['../components/**/*.stories.@(js|jsx|ts|tsx)'],
45
addons: [
56
'@storybook/addon-links',
@@ -15,4 +16,5 @@ const config = {
1516
},
1617
staticDirs: ['../public'],
1718
};
19+
1820
export default config;

.storybook/preview.js renamed to .storybook/preview.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import * as NextImage from 'next/image';
1+
import type { Preview } from '@storybook/react';
2+
import NextImage from 'next/image';
23
import App from '../pages/_app.mdx';
34
import { pageProps } from './constants';
5+
46
import '../styles/styles.scss';
57
import '../styles/tokens.scss';
68

7-
/** @type { import('@storybook/react').Preview } */
8-
const preview = {
9+
const preview: Preview = {
910
parameters: {
1011
actions: { argTypesRegex: '^on[A-Z].*' },
1112
controls: {
@@ -26,11 +27,9 @@ export const decorators = [
2627
Story => <App Component={Story} pageProps={pageProps} />,
2728
];
2829

29-
const OriginalNextImage = NextImage.default;
30-
3130
Object.defineProperty(NextImage, 'default', {
3231
configurable: true,
33-
value: props => <OriginalNextImage {...props} unoptimized />,
32+
value: props => <NextImage {...props} unoptimized />,
3433
});
3534

3635
export default preview;

.stylelintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"order/properties-alphabetical-order": true,
66
"no-descending-specificity": null,
77
"scss/at-extend-no-missing-placeholder": null,
8+
"scss/at-import-no-partial-leading-underscore": null,
89
"selector-pseudo-class-no-unknown": [
910
true,
1011
{ "ignorePseudoClasses": ["global"] }

components/Common/Banner/Banner.stories.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import type { StoryObj } from '@storybook/react';
2-
import Banner from './';
2+
import Banner from './index';
33

44
type Story = StoryObj<typeof Banner>;
55

66
const addDaysToDate = (numDays: number, date: Date) => {
77
const newDate = new Date(date);
88
newDate.setDate(date.getDate() + numDays);
9-
return date;
9+
return newDate;
1010
};
1111

1212
// Create mock start and end dates as Banner Component renders
@@ -36,7 +36,4 @@ export const WithHTML: Story = {
3636
},
3737
};
3838

39-
export default {
40-
title: 'Banner',
41-
component: Banner,
42-
};
39+
export default { component: Banner };

components/Common/Banner/index.module.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,23 @@
3333

3434
&.bannerBtn {
3535
background: var(--purple5);
36-
padding: 0 var(--space-16);
3736
border: 1px solid transparent;
3837
border-radius: 5.6rem;
3938
color: var(--color-fill-top-nav);
4039
font-family: var(--sans);
40+
font-size: 1rem;
4141
font-style: normal;
4242
font-weight: var(--font-weight-semibold);
4343
line-height: var(--line-height-subheading);
4444
margin-right: var(--space-32);
45+
padding: 0 var(--space-16);
4546
position: relative;
4647
text-decoration: none;
4748
white-space: nowrap;
48-
font-size: 1rem;
4949

5050
&:hover {
51-
cursor: pointer;
5251
background-color: $node-green !important;
52+
cursor: pointer;
5353
}
5454
}
5555
}
@@ -66,8 +66,8 @@
6666

6767
a {
6868
&:hover {
69-
text-decoration: underline;
7069
background-color: transparent !important;
70+
text-decoration: underline;
7171
}
7272
}
7373
}

0 commit comments

Comments
 (0)