forked from nodejs/nodejs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(banner): introduce new design (nodejs#5762)
* feat(banner): introduce new design related issue: nodejs#5760 * feat(banner): introduce new design related issue: nodejs#5760 * update form feedback * small update * update with feedback * Update components/Common/Banner/index.tsx Co-authored-by: Claudio W <cwunder@gnome.org> Signed-off-by: Augustin Mauroy <augustin.mauroy@outlook.fr> * Update index.tsx --------- Signed-off-by: Augustin Mauroy <augustin.mauroy@outlook.fr> Co-authored-by: Claudio W <cwunder@gnome.org>
- Loading branch information
1 parent
d411555
commit 1250ef9
Showing
3 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.banner { | ||
@apply text-sm text-white flex flex-row items-center justify-center gap-2 py-3 w-full; | ||
|
||
a { | ||
@apply underline; | ||
} | ||
|
||
svg { | ||
@apply h-4 w-4; | ||
} | ||
} | ||
|
||
.default { | ||
@apply bg-green-600; | ||
} | ||
|
||
.error { | ||
@apply bg-danger-600; | ||
} | ||
|
||
.warning { | ||
@apply bg-warning-600; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import type { Meta as MetaObj, StoryObj } from '@storybook/react'; | ||
import Banner from './'; | ||
|
||
type Story = StoryObj<typeof Banner>; | ||
type Meta = MetaObj<typeof Banner>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
text: 'Nodejs collaborator summitNode.js Collaborator Summit 2023 - Bilbao, Spain (OpenJS World EU) 2023', | ||
type: 'default', | ||
url: 'https://github.com/openjs-foundation/summit/issues/360', | ||
}, | ||
}; | ||
|
||
export const Error: Story = { | ||
args: { | ||
text: 'STOP creating issue for error 500 on download', | ||
type: 'error', | ||
url: 'https://github.com/nodejs/nodejs.org/issues/4495', | ||
}, | ||
}; | ||
|
||
export const Warning: Story = { | ||
args: { | ||
text: 'STOP creating issue for error 500 on download', | ||
type: 'warning', | ||
url: 'https://github.com/nodejs/nodejs.org/issues/4495', | ||
}, | ||
}; | ||
|
||
export const NoLink: Story = { | ||
args: { | ||
text: 'Claudio is the best maintainer', | ||
type: 'default', | ||
}, | ||
}; | ||
|
||
export const NoType: Story = { | ||
args: { | ||
text: 'Claudio is the best maintainer', | ||
url: 'https://github.com/ovflowd', | ||
}, | ||
}; | ||
|
||
export default { component: Banner } as Meta; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import LocalizedLink from '@/components/LocalizedLink'; | ||
import { ArrowUpRightIcon } from '@heroicons/react/24/outline'; | ||
import styles from './index.module.scss'; | ||
import type { FC } from 'react'; | ||
|
||
type BannerProps = { | ||
type: 'default' | 'error' | 'warning'; | ||
text: string; | ||
url?: string; | ||
}; | ||
|
||
const Banner: FC<BannerProps> = ({ type, text, url = '' }) => ( | ||
<div className={`${styles.banner} ${styles[type] || styles.default}`}> | ||
{(url.length > 0 && <LocalizedLink href={url}>{text}</LocalizedLink>) || | ||
text} | ||
{url.length > 0 && <ArrowUpRightIcon />} | ||
</div> | ||
); | ||
|
||
export default Banner; |