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.
Create Footer Component (nodejs#5983)
feat: Create Footer Component
- Loading branch information
Showing
9 changed files
with
221 additions
and
11 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,49 @@ | ||
.footer { | ||
@apply flex | ||
flex-col | ||
items-center | ||
gap-6 | ||
px-8 | ||
py-4 | ||
md:flex-row | ||
md:justify-between | ||
md:py-5; | ||
|
||
.sectionPrimary { | ||
@apply flex | ||
flex-wrap | ||
content-start | ||
items-center | ||
justify-center | ||
gap-1 | ||
self-stretch; | ||
|
||
a { | ||
@apply whitespace-nowrap; | ||
} | ||
} | ||
|
||
.sectionSecondary { | ||
@apply flex | ||
flex-col | ||
items-center | ||
gap-1 | ||
md:flex-row; | ||
|
||
.social { | ||
@apply flex | ||
items-center | ||
gap-1; | ||
} | ||
} | ||
|
||
.darkImage { | ||
@apply hidden | ||
dark:block; | ||
} | ||
|
||
.lightImage { | ||
@apply block | ||
dark:hidden; | ||
} | ||
} |
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,10 @@ | ||
import type { Meta as MetaObj, StoryObj } from '@storybook/react'; | ||
|
||
import Footer from './index'; | ||
|
||
type Story = StoryObj<typeof Footer>; | ||
type Meta = MetaObj<typeof Footer>; | ||
|
||
export const Default: Story = {}; | ||
|
||
export default { component: Footer } 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,58 @@ | ||
import classNames from 'classnames'; | ||
import Image from 'next/image'; | ||
import type { FC } from 'react'; | ||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import NavItem from '@/components/sections/NavItem'; | ||
import { useSiteConfig } from '@/hooks/useSiteConfig'; | ||
|
||
import styles from './index.module.css'; | ||
|
||
const Footer: FC = () => { | ||
const { footerLinks, socialLinks } = useSiteConfig(); | ||
|
||
const openJSlink = footerLinks.at(-1)!; | ||
|
||
return ( | ||
<footer className={styles.footer}> | ||
<div className={styles.sectionPrimary}> | ||
{footerLinks.slice(0, -1).map(item => ( | ||
<NavItem type="footer" href={item.link} key={item.link}> | ||
<FormattedMessage id={item.text} /> | ||
</NavItem> | ||
))} | ||
</div> | ||
<div className={styles.sectionSecondary}> | ||
<NavItem type="footer" href={openJSlink.link}> | ||
© <FormattedMessage id={openJSlink.text} /> | ||
</NavItem> | ||
<div className={styles.social}> | ||
{socialLinks.map(link => { | ||
const navClass = classNames({ | ||
[styles.darkImage]: link.kind === 'dark', | ||
[styles.lightImage]: link.kind === 'light', | ||
}); | ||
|
||
return ( | ||
<NavItem | ||
className={navClass} | ||
key={link.icon} | ||
href={link.link} | ||
type="footer" | ||
> | ||
<Image | ||
src={link.icon} | ||
alt={link.alt || 'social'} | ||
width={20} | ||
height={20} | ||
/> | ||
</NavItem> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
</footer> | ||
); | ||
}; | ||
|
||
export default Footer; |
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
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
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
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
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
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