Skip to content

feat(stylelint,storybook): fixed styleling misconfig and fixed storybooks #5281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .storybook/constants.ts → .storybook/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,4 @@ const nodeVersionData = {
],
};

export const pageProps = {
i18nData,
nodeVersionData,
};
export const pageProps = { i18nData, nodeVersionData };
6 changes: 4 additions & 2 deletions .storybook/main.js → .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @type { import('@storybook/nextjs').StorybookConfig } */
const config = {
import type { StorybookConfig } from '@storybook/nextjs';

const config: StorybookConfig = {
stories: ['../components/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-links',
Expand All @@ -15,4 +16,5 @@ const config = {
},
staticDirs: ['../public'],
};

export default config;
11 changes: 5 additions & 6 deletions .storybook/preview.js → .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import * as NextImage from 'next/image';
import type { Preview } from '@storybook/react';
import NextImage from 'next/image';
import App from '../pages/_app.mdx';
import { pageProps } from './constants';

import '../styles/styles.scss';
import '../styles/tokens.scss';

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

const OriginalNextImage = NextImage.default;

Object.defineProperty(NextImage, 'default', {
configurable: true,
value: props => <OriginalNextImage {...props} unoptimized />,
value: props => <NextImage {...props} unoptimized />,
});

export default preview;
1 change: 1 addition & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"order/properties-alphabetical-order": true,
"no-descending-specificity": null,
"scss/at-extend-no-missing-placeholder": null,
"scss/at-import-no-partial-leading-underscore": null,
"selector-pseudo-class-no-unknown": [
true,
{ "ignorePseudoClasses": ["global"] }
Expand Down
9 changes: 3 additions & 6 deletions components/Common/Banner/Banner.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { StoryObj } from '@storybook/react';
import Banner from './';
import Banner from './index';

type Story = StoryObj<typeof Banner>;

const addDaysToDate = (numDays: number, date: Date) => {
const newDate = new Date(date);
newDate.setDate(date.getDate() + numDays);
return date;
return newDate;
};

// Create mock start and end dates as Banner Component renders
Expand Down Expand Up @@ -36,7 +36,4 @@ export const WithHTML: Story = {
},
};

export default {
title: 'Banner',
component: Banner,
};
export default { component: Banner };
8 changes: 4 additions & 4 deletions components/Common/Banner/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@

&.bannerBtn {
background: var(--purple5);
padding: 0 var(--space-16);
border: 1px solid transparent;
border-radius: 5.6rem;
color: var(--color-fill-top-nav);
font-family: var(--sans);
font-size: 1rem;
font-style: normal;
font-weight: var(--font-weight-semibold);
line-height: var(--line-height-subheading);
margin-right: var(--space-32);
padding: 0 var(--space-16);
position: relative;
text-decoration: none;
white-space: nowrap;
font-size: 1rem;

&:hover {
cursor: pointer;
background-color: $node-green !important;
cursor: pointer;
}
}
}
Expand All @@ -66,8 +66,8 @@

a {
&:hover {
text-decoration: underline;
background-color: transparent !important;
text-decoration: underline;
}
}
}
Expand Down
Loading