Skip to content

Commit 3363a72

Browse files
committed
feat: initial commit
0 parents  commit 3363a72

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+9001
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.DS_Store
2+
3+
.next/
4+
node_modules/

CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nostalgi.cc

components/ActiveCategoryFilters.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import axios from 'axios'
2+
import classnames from 'classnames'
3+
4+
5+
6+
7+
8+
const ActiveCategoryFilters = ({ selectedCategories }) => (
9+
<div className="active-category-filters">
10+
<header>Active Filters:</header>
11+
12+
{!selectedCategories.length && (
13+
<div className="nes-badge">
14+
<span className="is-dark">None</span>
15+
</div>
16+
)}
17+
18+
{!!selectedCategories.length && (
19+
<ul className="inline wrappable">
20+
{selectedCategories.map(category => (
21+
<li key={category}>
22+
<div className="nes-badge">
23+
<span className="is-primary">{category}</span>
24+
</div>
25+
</li>
26+
))}
27+
</ul>
28+
)}
29+
</div>
30+
)
31+
32+
33+
34+
35+
36+
export default ActiveCategoryFilters

components/AppLayout.js

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
// Module imports
2+
import Head from 'next/head'
3+
import Error from 'next/error'
4+
import NProgress from 'nprogress'
5+
import React from 'react'
6+
import Router from 'next/router'
7+
8+
9+
10+
11+
12+
// Local imports
13+
import Banner from './Banner'
14+
import DocsToC from './DocsToC'
15+
16+
17+
18+
19+
20+
NProgress.configure({ showSpinner: false })
21+
Router.events.on('routeChangeStart', () => NProgress.start())
22+
Router.events.on('routeChangeError', () => NProgress.done())
23+
Router.events.on('routeChangeComplete', () => NProgress.done())
24+
25+
26+
27+
28+
29+
class AppLayout extends React.Component {
30+
/***************************************************************************\
31+
Public Methods
32+
\***************************************************************************/
33+
34+
static async getInitialProps ({ Component, ctx }) {
35+
const {
36+
asPath,
37+
isServer,
38+
query,
39+
} = ctx
40+
41+
let pageProps = {}
42+
43+
if (Component.getInitialProps) {
44+
pageProps = await Component.getInitialProps(ctx)
45+
}
46+
47+
let statusCode = 200
48+
49+
if (ctx.res) {
50+
({ statusCode } = ctx.res)
51+
}
52+
53+
return {
54+
statusCode,
55+
pageProps: {
56+
asPath,
57+
isServer,
58+
query,
59+
...pageProps,
60+
},
61+
}
62+
}
63+
64+
render () {
65+
const {
66+
Component,
67+
pageProps,
68+
router,
69+
statusCode,
70+
} = this.props
71+
72+
const isDocsPage = /^\/docs\//giu.test(router.asPath)
73+
const pageID = pageProps.asPath
74+
.replace(/^\//u, '')
75+
.replace('/', '-')
76+
77+
return (
78+
<div role="application">
79+
<Head>
80+
<link
81+
href="https://unpkg.com/nes.css@latest/css/nes-core.min.css"
82+
rel="stylesheet" />
83+
84+
<link
85+
href="https://unpkg.com/[email protected]/css/nes-icons.min.css"
86+
rel="stylesheet" />
87+
88+
<link
89+
href={`//fonts.googleapis.com/css?family=${['Press Start 2P'].join('|').replace(/\s/g, '+')}`}
90+
rel="stylesheet" />
91+
</Head>
92+
93+
<Banner path={pageProps.asPath} />
94+
95+
{(statusCode === 200) && (
96+
<main id={pageID || 'home'}>
97+
98+
{!isDocsPage && (
99+
<Component {...pageProps} />
100+
)}
101+
102+
{isDocsPage && (
103+
<>
104+
<DocsToC />
105+
106+
<article className="docs-content">
107+
<Component {...pageProps} />
108+
</article>
109+
</>
110+
)}
111+
</main>
112+
)}
113+
114+
{(statusCode !== 200) && (
115+
<main className="error-page">
116+
<Error statusCode={statusCode} />
117+
</main>
118+
)}
119+
</div>
120+
)
121+
}
122+
}
123+
124+
125+
126+
127+
128+
export default AppLayout

components/ApplicationNav.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Module imports
2+
import classnames from 'classnames'
3+
4+
5+
6+
7+
8+
// Component imports
9+
import Link from './Link'
10+
11+
12+
13+
14+
15+
const links = [
16+
{
17+
href: '/',
18+
title: 'Home',
19+
},
20+
{
21+
href: '/docs/start',
22+
title: 'Start',
23+
},
24+
{
25+
href: '/icons',
26+
title: 'Icons',
27+
},
28+
{
29+
href: '/docs',
30+
title: 'Docs',
31+
},
32+
]
33+
34+
35+
36+
37+
38+
const ApplicationNav = ({ path }) => (
39+
<nav className="application-nav">
40+
<ul className="inline">
41+
{links.map(link => {
42+
const isActive = link.href === path
43+
44+
return (
45+
<li key={link.href}>
46+
<Link href={link.href}>
47+
<a
48+
className={classnames({ active: isActive })}>
49+
<i
50+
className="nes-icon caret-right"
51+
data-animate={isActive}
52+
data-animation="full-pulse"
53+
data-animation-duration="1s" />
54+
{link.title}
55+
</a>
56+
</Link>
57+
</li>
58+
)
59+
})}
60+
</ul>
61+
</nav>
62+
)
63+
64+
65+
66+
67+
68+
export default ApplicationNav

components/Banner.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Module imports
2+
import ApplicationNav from './ApplicationNav'
3+
import Brand from './Brand'
4+
import Link from './Link'
5+
import SocialLinks from './SocialLinks'
6+
7+
8+
9+
10+
11+
const Banner = ({ path }) => (
12+
<div role="banner">
13+
<Link href="/">
14+
<a><Brand /></a>
15+
</Link>
16+
17+
<ApplicationNav path={path} />
18+
19+
<SocialLinks />
20+
</div>
21+
)
22+
23+
24+
25+
26+
27+
export default Banner

components/Brand.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import Link from 'next/link'
2+
3+
4+
5+
6+
7+
const Brand = () => (
8+
<h1
9+
aria-label="NES.icons"
10+
className="brand">
11+
<img src="/static/nes-color.svg" />
12+
13+
NES.icons
14+
</h1>
15+
)
16+
17+
18+
19+
20+
21+
export default Brand

components/CategoryFilters.js

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import axios from 'axios'
2+
import classnames from 'classnames'
3+
4+
5+
6+
7+
8+
const CategoryFilters = props => {
9+
const {
10+
categories,
11+
selectedCategories,
12+
} = props
13+
let {
14+
onClearFilters,
15+
onFilterClick,
16+
} = props
17+
18+
if (!onClearFilters) {
19+
onClearFilters = () => {}
20+
}
21+
22+
if (!onFilterClick) {
23+
onFilterClick = () => {}
24+
}
25+
26+
return (
27+
<menu
28+
className="category-filters is-rounded nes-container"
29+
type="toolbar">
30+
<li>
31+
<button
32+
className={classnames({
33+
'nes-btn': true,
34+
'is-disabled': !selectedCategories.length,
35+
'is-error': !!selectedCategories.length,
36+
})}
37+
disabled={!selectedCategories.length}
38+
onClick={onClearFilters}
39+
type="button">
40+
<span>
41+
<i className="nes-icon times" /> Clear Filters
42+
</span>
43+
</button>
44+
</li>
45+
46+
{categories.sort().map(category => (
47+
<li key={category}>
48+
<button
49+
className={classnames({
50+
'is-primary': selectedCategories.includes(category),
51+
'nes-btn': true,
52+
})}
53+
onClick={onFilterClick}
54+
title={category}
55+
type="button"
56+
value={category}>
57+
<span>{category}</span>
58+
</button>
59+
</li>
60+
))}
61+
</menu>
62+
)
63+
}
64+
65+
66+
67+
68+
69+
export default CategoryFilters

0 commit comments

Comments
 (0)