1
0
Fork 0

everything passes lint

This commit is contained in:
Enoch Riese 2022-12-03 11:25:02 -06:00
parent e28ca4ea86
commit 477a4d93f5
24 changed files with 304 additions and 303 deletions

View file

@ -1,5 +1,4 @@
import { useState, useEffect } from 'react'
import Link from 'next/link'
import ThemePicker from 'shared/components/theme-picker.js'
import LocalePicker from 'shared/components/locale-picker.js'
import CloseIcon from 'shared/components/icons/close.js'

View file

@ -1,44 +1,52 @@
import Popout from 'shared/components/popout.js'
const HelpUs = ({ mdx=false, slug='/' }) => (
const HelpUs = ({ mdx = false, slug = '/' }) => (
<details className="mt-4">
<summary>Click here to learn how you can help us improve this page</summary>
{mdx && (
<Popout tip className='max-w-prose'>
<Popout tip className="max-w-prose">
<h6>Found a mistake?</h6>
You can <a
You can{' '}
<a
href={`https://github.com/freesewing/freesewing/edit/develop/markdown/dev/${slug}/en.md`}
className="text-secondary font-bold"
>edit this page on Github</a> and help us improve our documentation.
>
edit this page on Github
</a>{' '}
and help us improve our documentation.
</Popout>
)}
<Popout comment by="joost" className='max-w-prose'>
<Popout comment by="joost" className="max-w-prose">
<h6>Does this look ok?</h6>
<img
className="my-4 rounded"
src={`https://canary.backend.freesewing.org/og-img/en/dev${slug}`}
alt="auto-generated banner"
/>
<p>
If it looks ok, great! But if not, please let me know about it.
Either by <a href="https://discord.freesewing.org/" className="text-secondary">
If it looks ok, great! But if not, please let me know about it. Either by{' '}
<a href="https://discord.freesewing.org/" className="text-secondary">
reaching out on Discord
</a> or feel free to <a
</a>{' '}
or feel free to{' '}
<a
href="https://github.com/freesewing/freesewing/issues/new/choose"
className="text-secondary"
>create
an issue on Github</a>.
>
create an issue on Github
</a>
.
</p>
<h6>Why do you ask?</h6>
<p className="text-base">
I recently added a backend endpoint to auto-generate pretty (I hope) Open Graph images.
They are those little preview images you see when you paste a link in Discord (for example).
I recently added a backend endpoint to auto-generate pretty (I hope) Open Graph images. They
are those little preview images you see when you paste a link in Discord (for example).
</p>
<p className="text-base">
This idea is that it will auto-generate an image, but I am certain there are some edge cases
where that will not work.
There are hundreds of pages on this website and checking them all one by one is not something
I see myself doing. But since you are here on this page, perhaps you could see if the image
above looks ok.
where that will not work. There are hundreds of pages on this website and checking them all
one by one is not something I see myself doing. But since you are here on this page, perhaps
you could see if the image above looks ok.
</p>
<p className="text-base">Thank you, I really appreciate your help with this.</p>
</Popout>
@ -46,4 +54,3 @@ const HelpUs = ({ mdx=false, slug='/' }) => (
)
export default HelpUs

View file

@ -2,7 +2,7 @@ import { useRouter } from 'next/router'
import Aside from 'shared/components/navigation/aside'
import ThemePicker from 'shared/components/theme-picker'
const DefaultLayout = ({ app, title=false, children=[] }) => {
const DefaultLayout = ({ app, children = [] }) => {
const router = useRouter()
const slug = router.asPath.slice(1)

View file

@ -1,19 +1,9 @@
import { useState } from 'react'
import { useRouter } from 'next/router'
import Header from 'site/components/header'
import Footer from 'site/components/footer'
import Search from 'site/components/search'
const LayoutWrapper = ({
app,
title=false,
children=[],
search,
setSearch,
noSearch=false,
workbench=false,
AltMenu=null,
}) => {
const LayoutWrapper = ({ app, children = [], search, setSearch, noSearch = false }) => {
const startNavigation = () => {
app.startLoading()
// Force close of menu on mobile if it is open
@ -25,29 +15,31 @@ const LayoutWrapper = ({
const router = useRouter()
router.events?.on('routeChangeStart', startNavigation)
router.events?.on('routeChangeComplete', () => app.stopLoading())
const [collapsePrimaryNav, setCollapsePrimaryNav] = useState(workbench || false)
const [collapseAltMenu, setCollapseAltMenu] = useState(false)
return (
<div className={`
<div
className={`
flex flex-col justify-between
min-h-screen
bg-base-100
`}>
`}
>
<Header app={app} setSearch={setSearch} />
<main className="grow">{children}</main>
{!noSearch && search && (
<>
<div className={`
<div
className={`
fixed w-full max-h-screen bg-base-100 top-0 z-30 pt-0 pb-16 px-8
md:rounded-lg md:top-24
md:max-w-xl md:m-auto md:inset-x-12
md:max-w-2xl
lg:max-w-4xl
`}>
<Search app={app} search={search} setSearch={setSearch}/>
</div>
<div className="fixed top-0 left-0 w-full min-h-screen bg-neutral z-20 bg-opacity-70"></div>
`}
>
<Search app={app} search={search} setSearch={setSearch} />
</div>
<div className="fixed top-0 left-0 w-full min-h-screen bg-neutral z-20 bg-opacity-70"></div>
</>
)}
<Footer app={app} />

View file

@ -9,25 +9,24 @@ import Docs from 'site/components/layouts/docs'
import Feeds from 'site/components/feeds.js'
/* This component should wrap all page content */
const PageWrapper= ({
title="FIXME: No title set",
noSearch=false,
app=false,
layout=Docs,
crumbs=false,
children=[]
const PageWrapper = ({
title = 'FIXME: No title set',
noSearch = false,
app = false,
layout = Docs,
crumbs = false,
children = [],
}) => {
const swipeHandlers = useSwipeable({
onSwipedLeft: evt => (app.primaryMenu) ? app.setPrimaryMenu(false) : null,
onSwipedRight: evt => (app.primaryMenu) ? null : app.setPrimaryMenu(true),
trackMouse: true
onSwipedLeft: () => (app.primaryMenu ? app.setPrimaryMenu(false) : null),
onSwipedRight: () => (app.primaryMenu ? null : app.setPrimaryMenu(true)),
trackMouse: true,
})
const router = useRouter()
const slug = router.asPath.slice(1)
useEffect(() => app.setSlug(slug), [slug])
useEffect(() => app.setSlug(slug), [slug, app])
// Trigger search with Ctrl+k
useHotkeys('ctrl+k', (evt) => {
@ -41,7 +40,9 @@ const PageWrapper= ({
app: app,
title: title,
crumbs: crumbs,
search, setSearch, toggleSearch: () => setSearch(!search),
search,
setSearch,
toggleSearch: () => setSearch(!search),
noSearch: noSearch,
}
@ -56,14 +57,10 @@ const PageWrapper= ({
>
<Feeds lang={app.locale} />
<LayoutWrapper {...childProps}>
{Layout
? <Layout {...childProps}>{children}</Layout>
: children
}
{Layout ? <Layout {...childProps}>{children}</Layout> : children}
</LayoutWrapper>
</div>
)
}
export default PageWrapper