Skip to content

Commit 1250ef9

Browse files
feat(banner): introduce new design (#5762)
* feat(banner): introduce new design related issue: #5760 * feat(banner): introduce new design related issue: #5760 * update form feedback * small update * update with feedback * Update components/Common/Banner/index.tsx Co-authored-by: Claudio W <[email protected]> Signed-off-by: Augustin Mauroy <[email protected]> * Update index.tsx --------- Signed-off-by: Augustin Mauroy <[email protected]> Co-authored-by: Claudio W <[email protected]>
1 parent d411555 commit 1250ef9

File tree

3 files changed

+88
-0
lines changed

3 files changed

+88
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.banner {
2+
@apply text-sm text-white flex flex-row items-center justify-center gap-2 py-3 w-full;
3+
4+
a {
5+
@apply underline;
6+
}
7+
8+
svg {
9+
@apply h-4 w-4;
10+
}
11+
}
12+
13+
.default {
14+
@apply bg-green-600;
15+
}
16+
17+
.error {
18+
@apply bg-danger-600;
19+
}
20+
21+
.warning {
22+
@apply bg-warning-600;
23+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import type { Meta as MetaObj, StoryObj } from '@storybook/react';
2+
import Banner from './';
3+
4+
type Story = StoryObj<typeof Banner>;
5+
type Meta = MetaObj<typeof Banner>;
6+
7+
export const Default: Story = {
8+
args: {
9+
text: 'Nodejs collaborator summitNode.js Collaborator Summit 2023 - Bilbao, Spain (OpenJS World EU) 2023',
10+
type: 'default',
11+
url: 'https://github.com/openjs-foundation/summit/issues/360',
12+
},
13+
};
14+
15+
export const Error: Story = {
16+
args: {
17+
text: 'STOP creating issue for error 500 on download',
18+
type: 'error',
19+
url: 'https://github.com/nodejs/nodejs.org/issues/4495',
20+
},
21+
};
22+
23+
export const Warning: Story = {
24+
args: {
25+
text: 'STOP creating issue for error 500 on download',
26+
type: 'warning',
27+
url: 'https://github.com/nodejs/nodejs.org/issues/4495',
28+
},
29+
};
30+
31+
export const NoLink: Story = {
32+
args: {
33+
text: 'Claudio is the best maintainer',
34+
type: 'default',
35+
},
36+
};
37+
38+
export const NoType: Story = {
39+
args: {
40+
text: 'Claudio is the best maintainer',
41+
url: 'https://github.com/ovflowd',
42+
},
43+
};
44+
45+
export default { component: Banner } as Meta;

components/Common/Banner/index.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import LocalizedLink from '@/components/LocalizedLink';
2+
import { ArrowUpRightIcon } from '@heroicons/react/24/outline';
3+
import styles from './index.module.scss';
4+
import type { FC } from 'react';
5+
6+
type BannerProps = {
7+
type: 'default' | 'error' | 'warning';
8+
text: string;
9+
url?: string;
10+
};
11+
12+
const Banner: FC<BannerProps> = ({ type, text, url = '' }) => (
13+
<div className={`${styles.banner} ${styles[type] || styles.default}`}>
14+
{(url.length > 0 && <LocalizedLink href={url}>{text}</LocalizedLink>) ||
15+
text}
16+
{url.length > 0 && <ArrowUpRightIcon />}
17+
</div>
18+
);
19+
20+
export default Banner;

0 commit comments

Comments
 (0)