Skip to content

Commit

Permalink
Fix prettier formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephusPaye committed Aug 15, 2021
1 parent 1bde6b7 commit 3cc5ab6
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 66 deletions.
2 changes: 1 addition & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ module.exports = {
return site.siteMetadata.siteUrl
},
serialize: ({ site, allSitePage }) => {
return allSitePage.nodes.map(node => {
return allSitePage.nodes.map((node) => {
return {
url: `${site.siteMetadata.siteUrl}${node.path}`,
changefreq: `weekly`,
Expand Down
14 changes: 7 additions & 7 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
})

// Hide sections and chapters in the menu if all their content is hidden
menu.forEach(section => {
section.chapters.forEach(chapter => {
chapter.hidden = chapter.pages.every(page => page.hidden)
menu.forEach((section) => {
section.chapters.forEach((chapter) => {
chapter.hidden = chapter.pages.every((page) => page.hidden)
})

section.hidden = section.chapters.every(chapter => chapter.hidden)
section.hidden = section.chapters.every((chapter) => chapter.hidden)
})

const templatePath = path.resolve('./src/components/page-template.jsx')
Expand Down Expand Up @@ -133,7 +133,7 @@ exports.onCreateWebpackConfig = ({ stage, actions, getConfig, plugins }) => {
const config = getConfig()

const miniCssExtractPluginIndex = config.plugins.findIndex(
plugin => plugin.constructor.name === 'MiniCssExtractPlugin'
(plugin) => plugin.constructor.name === 'MiniCssExtractPlugin'
)

if (miniCssExtractPluginIndex > -1) {
Expand Down Expand Up @@ -166,7 +166,7 @@ exports.onCreateWebpackConfig = ({ stage, actions, getConfig, plugins }) => {
*/
function findOrCreateSection(menu, node) {
const section = menu.find(
section => section.title === node.frontmatter.section
(section) => section.title === node.frontmatter.section
)

if (section) {
Expand All @@ -190,7 +190,7 @@ function findOrCreateSection(menu, node) {
*/
function findOrCreateChapter(section, node) {
const chapter = section.chapters.find(
chapter => chapter.title === node.frontmatter.chapter
(chapter) => chapter.title === node.frontmatter.chapter
)

if (chapter) {
Expand Down
6 changes: 1 addition & 5 deletions src/book/kitchen-sink/06-lists.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ hidden: true
```js
const oven = Oven.acquire()
const dough = Dough.acquire()
oven
.prepare()
.preheat()
.place(dough)
.bake()
oven.prepare().preheat().place(dough).bake()
// Pretty long comment line to force a scrollbar. Writing a random long sentence is not as easy as it may seem. You have to really string together words and phrases that somehow work without really saying anything.
```

Expand Down
2 changes: 1 addition & 1 deletion src/components/header/links/links.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const Links = ({ color }) => (
}
}
`}
render={data => {
render={(data) => {
const { githubUrl, slackUrl, facebookUrl, email } = data.site.siteMetadata
return (
<>
Expand Down
8 changes: 4 additions & 4 deletions src/components/header/menu/menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ const Menu = ({ menu, currentSection, open, isHome }) => {
<div className='mb-8'>
{menu
// Only show a section if it's currently selected or it's not hidden
.filter(section => {
.filter((section) => {
return (
section.title === currentSection.title || !section.hidden
)
})
.map(section => {
.map((section) => {
const className = `${style.sectionLink} ${
!isHome && section.title === currentSection.title
? `${style.sectionLinkActive}`
Expand All @@ -58,11 +58,11 @@ const Menu = ({ menu, currentSection, open, isHome }) => {
})}
</div>

{currentSection.chapters.map(chapter => {
{currentSection.chapters.map((chapter) => {
return (
<section className='mb-6' key={chapter.title}>
<h3 className={style.chapterTitle}>{chapter.title}</h3>
{chapter.pages.map(page => (
{chapter.pages.map((page) => (
<Link
to={page.slug}
key={page.slug}
Expand Down
4 changes: 2 additions & 2 deletions src/components/landing/book/book.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Book = ({ contents }) => {
<div>
<div className='flex mb-6 overflow-x-auto md:justify-center'>
{contents
.filter(section => !section.hidden)
.filter((section) => !section.hidden)
.map((section, i) => {
return (
<Section
Expand All @@ -42,7 +42,7 @@ const Book = ({ contents }) => {
</div>
<div className='bg-gray-100 dark:bg-gray-950 border-2 border-nubots-500 rounded'>
<div className='p-4 grid gap-4 xxs:p-5 xxs:gap-5 md:p-6 md:gap-6 md:grid-cols-2 lg:grid-cols-3 lg:p-8 xl:p-12 xl:gap-8'>
{contents[currentSectionIndex].chapters.map(chapter => {
{contents[currentSectionIndex].chapters.map((chapter) => {
return (
<Chapter
title={chapter.title}
Expand Down
2 changes: 1 addition & 1 deletion src/components/landing/book/chapter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Chapter = ({ title, pages }) => {
{title}
</h3>
<div>
{pages.map(page => (
{pages.map((page) => (
<a
href={page.slug}
key={page.slug}
Expand Down
4 changes: 2 additions & 2 deletions src/components/landing/landing.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import PromoCard from './promo-card/promo-card'

import Book from './book/book'

const LandingPage = props => {
const LandingPage = (props) => {
const { menu } = props.pageContext
return (
<>
Expand All @@ -25,7 +25,7 @@ const LandingPage = props => {

<Header
menu={menu}
currentSection={menu.filter(section => !section.hidden)[0]}
currentSection={menu.filter((section) => !section.hidden)[0]}
background='transparent'
height='h-20'
/>
Expand Down
4 changes: 2 additions & 2 deletions src/components/layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const Layout = ({ children, data, pageContext }) => {
} = data.mdx.frontmatter
const { next, previous, menu } = pageContext
const currentSection =
menu.find(section => section.title === sectionTitle) || menu[0]
menu.find((section) => section.title === sectionTitle) || menu[0]
const currentChapter = currentSection.chapters.find(
chapter => chapter.title === chapterTitle
(chapter) => chapter.title === chapterTitle
)
const sidebarWrapperRef = useRef(null)
return (
Expand Down
6 changes: 3 additions & 3 deletions src/components/markdown/image.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { GatsbyImage } from 'gatsby-plugin-image'
* the matched image to render the image using the GatsbyImage component. All of this matching
* is only applied for local, non-SVG images.
*/
const Image = props => (
const Image = (props) => (
<StaticQuery
query={graphql`
query {
Expand All @@ -33,7 +33,7 @@ const Image = props => (
}
}
`}
render={data => {
render={(data) => {
const src = props.src
let Img

Expand Down Expand Up @@ -61,7 +61,7 @@ const Image = props => (
// in NUbook and render with GatsbyImage, which will handle resizing and responsiveness,
// picking the correct resolution appropriate for the client browser.
else {
const imageNode = data.allFile.nodes.find(node => {
const imageNode = data.allFile.nodes.find((node) => {
return node.absolutePath === src
})

Expand Down
4 changes: 2 additions & 2 deletions src/components/page-template.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { MDXRenderer } from 'gatsby-plugin-mdx'

import Layout from './layout'

const PageTemplate = props => {
const PageTemplate = (props) => {
return (
<Layout pageContext={props.pageContext} data={props.data}>
<MDXRenderer>{props.data.mdx.body}</MDXRenderer>
Expand Down Expand Up @@ -36,7 +36,7 @@ PageTemplate.propTypes = {
export default PageTemplate

export const query = graphql`
query($id: String!) {
query ($id: String!) {
mdx(id: { eq: $id }) {
id
body
Expand Down
5 changes: 2 additions & 3 deletions src/components/seo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function SEO({ description, lang, meta, keywords, title }) {
return (
<StaticQuery
query={detailsQuery}
render={data => {
render={(data) => {
const metaDescription =
description || data.site.siteMetadata.description
const pageKeywords =
Expand All @@ -22,8 +22,7 @@ function SEO({ description, lang, meta, keywords, title }) {
link={[
{
rel: 'stylesheet',
href:
'https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css',
href: 'https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css',
},
]}
script={[
Expand Down
8 changes: 4 additions & 4 deletions src/components/sidebar/sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ const Sidebar = ({ menu, currentSection, wrapperRef }) => {
<div className='mb-8'>
{menu
// Only show a section if it's currently selected or it's not hidden
.filter(section => {
.filter((section) => {
return section.title === currentSection.title || !section.hidden
})
.map(section => {
.map((section) => {
return (
<SectionButton
Icon={iconMap[section.title]}
Expand All @@ -69,15 +69,15 @@ const Sidebar = ({ menu, currentSection, wrapperRef }) => {
})}
</div>

{currentSection.chapters.map(chapter => {
{currentSection.chapters.map((chapter) => {
return (
<div className='mb-8' key={chapter.title}>
<div
className={`${style.chapterTitle} text-hint dark:text-hint-inverted`}
>
{chapter.title}
</div>
{chapter.pages.map(page => (
{chapter.pages.map((page) => (
<Link to={page.slug} key={page.slug} getProps={getLinkProps}>
{page.title}
</Link>
Expand Down
2 changes: 1 addition & 1 deletion src/components/table-of-contents/table-of-contents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PropTypes from 'prop-types'
import * as style from './table-of-contents.module.css'

const Contents = ({ contents, level }) => {
return contents.items.map(item => (
return contents.items.map((item) => (
<div className={level > 0 ? 'pl-4' : undefined} key={item.url}>
<a
href={item.url}
Expand Down
56 changes: 28 additions & 28 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,35 @@ module.exports = {
extend: {
colors: {
'gray': {
'100': '#f5f5f5',
'200': '#eeeeee',
'300': '#e0e0e0',
'400': '#bdbdbd',
'500': '#9e9e9e',
'600': '#757575',
'700': '#616161',
'800': '#424242',
'900': '#212121',
'950': '#111111',
100: '#f5f5f5',
200: '#eeeeee',
300: '#e0e0e0',
400: '#bdbdbd',
500: '#9e9e9e',
600: '#757575',
700: '#616161',
800: '#424242',
900: '#212121',
950: '#111111',
},
'orange': {
'100': '#fffaf0',
'200': '#feebc8',
'300': '#fbd38d',
'400': '#f6ad55',
'500': '#ed8936',
'600': '#dd6b20',
'700': '#c05621',
'800': '#9c4221',
'900': '#7b341e',
100: '#fffaf0',
200: '#feebc8',
300: '#fbd38d',
400: '#f6ad55',
500: '#ed8936',
600: '#dd6b20',
700: '#c05621',
800: '#9c4221',
900: '#7b341e',
},
'nubots': {
'100': '#FFF1D6',
'200': '#FFEBC7',
'300': '#FFDD9E',
'400': '#FFCC6F',
'500': '#F9A50D',
'700': '#CC880D',
100: '#FFF1D6',
200: '#FFEBC7',
300: '#FFDD9E',
400: '#FFCC6F',
500: '#F9A50D',
700: '#CC880D',
},
'primary': 'rgba(0, 0, 0, 0.87)',
'primary-inverted': 'rgba(255, 255, 255, 0.87)',
Expand All @@ -72,11 +72,11 @@ module.exports = {
'hint-inverted': 'rgba(255, 255, 255, 0.38)',
},
backgroundColor: {
'950': '#111111',
950: '#111111',
},
padding: {
'14': '3.5rem',
'26': '6.5rem',
14: '3.5rem',
26: '6.5rem',
},
maxWidth: {
'screen-xl': '1280px',
Expand Down

0 comments on commit 3cc5ab6

Please sign in to comment.