diff --git a/sites/org/components/account/bio/index.js b/sites/org/components/account/bio/index.mjs similarity index 91% rename from sites/org/components/account/bio/index.js rename to sites/org/components/account/bio/index.mjs index 659416e7f2d..cf7aeea107f 100644 --- a/sites/org/components/account/bio/index.js +++ b/sites/org/components/account/bio/index.mjs @@ -1,10 +1,12 @@ +// Hooks import { useState } from 'react' import { useTranslation } from 'next-i18next' -import useBackend from 'site/hooks/useBackend.js' +import { useBackend } from 'site/hooks/useBackend.mjs' +// Components import Link from 'next/link' -import { Icons, welcomeSteps } from '../shared.js' -import Popout from 'shared/components/popout.js' import Markdown from 'react-markdown' +import { Icons, welcomeSteps } from '../shared.mjs' +import { Popout } from 'shared/components/popout.mjs' export const ns = ['bio'] @@ -18,7 +20,7 @@ const Tab = ({ id, activeTab, setActiveTab, t }) => ( ) -const UsernameSettings = ({ app, title = false, welcome = false }) => { +export const BioSettings = ({ app, title = false, welcome = false }) => { const backend = useBackend(app) const { t } = useTranslation(ns) const [bio, setBio] = useState(app.account.bio) @@ -91,5 +93,3 @@ const UsernameSettings = ({ app, title = false, welcome = false }) => { ) } - -export default UsernameSettings diff --git a/sites/org/components/account/compare/index.js b/sites/org/components/account/compare/index.mjs similarity index 93% rename from sites/org/components/account/compare/index.js rename to sites/org/components/account/compare/index.mjs index 59cd86e9083..b247776b115 100644 --- a/sites/org/components/account/compare/index.js +++ b/sites/org/components/account/compare/index.mjs @@ -1,8 +1,10 @@ +// Hooks import { useState } from 'react' import { useTranslation } from 'next-i18next' -import useBackend from 'site/hooks/useBackend.js' +import { useBackend } from 'site/hooks/useBackend.mjs' +// Components import Link from 'next/link' -import { Choice, Icons, welcomeSteps } from '../shared.js' +import { Choice, Icons, welcomeSteps } from '../shared.mjs' export const ns = ['compare'] diff --git a/sites/org/components/account/control/index.js b/sites/org/components/account/control/index.mjs similarity index 94% rename from sites/org/components/account/control/index.js rename to sites/org/components/account/control/index.mjs index d8eb0a5c806..ae23d7c1998 100644 --- a/sites/org/components/account/control/index.js +++ b/sites/org/components/account/control/index.mjs @@ -1,8 +1,10 @@ +// Hooks import { useState } from 'react' import { useTranslation } from 'next-i18next' -import useBackend from 'site/hooks/useBackend.js' +import { useBackend } from 'site/hooks/useBackend.mjs' +// Components import Link from 'next/link' -import { Choice, Icons, welcomeSteps } from '../shared.js' +import { Choice, Icons, welcomeSteps } from '../shared.mjs' export const ns = ['control'] diff --git a/sites/org/components/account/img/index.js b/sites/org/components/account/img/index.mjs similarity index 92% rename from sites/org/components/account/img/index.js rename to sites/org/components/account/img/index.mjs index 3140f1c0115..282be13a1f1 100644 --- a/sites/org/components/account/img/index.js +++ b/sites/org/components/account/img/index.mjs @@ -1,13 +1,15 @@ +// Hooks import { useState, useCallback } from 'react' import { useTranslation } from 'next-i18next' -import useBackend from 'site/hooks/useBackend.js' -import Link from 'next/link' -import { Icons, welcomeSteps } from '../shared.js' +import { useBackend } from 'site/hooks/useBackend.mjs' import { useDropzone } from 'react-dropzone' +// Components +import Link from 'next/link' +import { Icons, welcomeSteps } from '../shared.mjs' export const ns = ['img'] -const ImgSettings = ({ app, title = false, welcome = false }) => { +export const ImgSettings = ({ app, title = false, welcome = false }) => { const backend = useBackend(app) const { t } = useTranslation(ns) @@ -80,5 +82,3 @@ const ImgSettings = ({ app, title = false, welcome = false }) => { ) } - -export default ImgSettings diff --git a/sites/org/components/account/newsletter/index.js b/sites/org/components/account/newsletter/index.mjs similarity index 93% rename from sites/org/components/account/newsletter/index.js rename to sites/org/components/account/newsletter/index.mjs index c7e9ba57aef..e04fd06f6ab 100644 --- a/sites/org/components/account/newsletter/index.js +++ b/sites/org/components/account/newsletter/index.mjs @@ -1,8 +1,10 @@ +// Hooks import { useState } from 'react' import { useTranslation } from 'next-i18next' -import useBackend from 'site/hooks/useBackend.js' +import { useBackend } from 'site/hooks/useBackend.mjs' +// Components import Link from 'next/link' -import { Choice, Icons, welcomeSteps } from '../shared.js' +import { Choice, Icons, welcomeSteps } from '../shared.mjs' export const ns = ['newsletter'] diff --git a/sites/org/components/account/shared.js b/sites/org/components/account/shared.mjs similarity index 83% rename from sites/org/components/account/shared.js rename to sites/org/components/account/shared.mjs index 75f856bb198..76c70a36e8a 100644 --- a/sites/org/components/account/shared.js +++ b/sites/org/components/account/shared.mjs @@ -1,12 +1,14 @@ import Link from 'next/link' -import CogIcon from 'shared/components/icons/cog.js' -import ControlIcon from 'shared/components/icons/control.js' -import NewsletterIcon from 'shared/components/icons/newsletter.js' -import UnitsIcon from 'shared/components/icons/units.js' -import CompareIcon from 'shared/components/icons/compare.js' -import LabelIcon from 'shared/components/icons/label.js' -import BioIcon from 'shared/components/icons/bio.js' -import UserIcon from 'shared/components/icons/user.js' +import { + CogIcon, + ControlIcon, + NewsletterIcon, + UnitsIcon, + CompareIcon, + LabelIcon, + BioIcon, + UserIcon, +} from 'shared/components/icons.mjs' const btnClasses = { dflt: diff --git a/sites/org/components/account/units/index.js b/sites/org/components/account/units/index.mjs similarity index 87% rename from sites/org/components/account/units/index.js rename to sites/org/components/account/units/index.mjs index 9ee93e7ea35..e9acd171166 100644 --- a/sites/org/components/account/units/index.js +++ b/sites/org/components/account/units/index.mjs @@ -1,12 +1,14 @@ +// Hooks import { useState } from 'react' import { useTranslation } from 'next-i18next' -import useBackend from 'site/hooks/useBackend.js' +import { useBackend } from 'site/hooks/useBackend.mjs' +// Components import Link from 'next/link' -import { Choice, Icons, welcomeSteps } from '../shared.js' +import { Choice, Icons, welcomeSteps } from '../shared.mjs' export const ns = ['units'] -const UnitsSettings = ({ app, title = false, welcome = false }) => { +export const UnitsSettings = ({ app, title = false, welcome = false }) => { const backend = useBackend(app) const { t } = useTranslation(ns) const [selection, setSelection] = useState(app.account?.imperial === true ? 'imperial' : 'metric') @@ -25,7 +27,7 @@ const UnitsSettings = ({ app, title = false, welcome = false }) => { return ( <> - {title ?

{t('title')}

: null} + {title ?

{t('title')}

:

} {['metric', 'imperial'].map((val) => ( @@ -61,5 +63,3 @@ const UnitsSettings = ({ app, title = false, welcome = false }) => { ) } - -export default UnitsSettings diff --git a/sites/org/components/account/username/index.js b/sites/org/components/account/username/index.mjs similarity index 89% rename from sites/org/components/account/username/index.js rename to sites/org/components/account/username/index.mjs index db27e66b41e..5bdfe869659 100644 --- a/sites/org/components/account/username/index.js +++ b/sites/org/components/account/username/index.mjs @@ -1,14 +1,15 @@ +// Hooks import { useState } from 'react' import { useTranslation } from 'next-i18next' -import useBackend from 'site/hooks/useBackend.js' +import { useBackend } from 'site/hooks/useBackend.mjs' +// Components import Link from 'next/link' -import { Icons, welcomeSteps } from '../shared.js' -import OkIcon from 'shared/components/icons/ok.js' -import NoIcon from 'shared/components/icons/no.js' +import { Icons, welcomeSteps } from '../shared.mjs' +import { OkIcon, NoIcon } from 'shared/components/icons.mjs' export const ns = ['username'] -const UsernameSettings = ({ app, title = false, welcome = false }) => { +export const UsernameSettings = ({ app, title = false, welcome = false }) => { const backend = useBackend(app) const { t } = useTranslation(ns) const [username, setUsername] = useState(app.account.username) @@ -85,5 +86,3 @@ const UsernameSettings = ({ app, title = false, welcome = false }) => { ) } - -export default UsernameSettings diff --git a/sites/org/components/design.js b/sites/org/components/design.mjs similarity index 98% rename from sites/org/components/design.js rename to sites/org/components/design.mjs index 1b16b9991b4..a8b670734ed 100644 --- a/sites/org/components/design.js +++ b/sites/org/components/design.mjs @@ -1,7 +1,7 @@ import { useState, useEffect } from 'react' import { useTranslation } from 'next-i18next' import { configs } from 'shared/designs/index.js' -import DesignIcon from 'shared/components/icons/design.js' +import { DesignIcon } from 'shared/components/icons.mjs' import Worm from 'shared/components/worm.js' import { strapiHost } from 'shared/config/freesewing.mjs' import Link from 'next/link' diff --git a/sites/org/components/feeds.js b/sites/org/components/feeds.js deleted file mode 100644 index 878e9a54a23..00000000000 --- a/sites/org/components/feeds.js +++ /dev/null @@ -1,70 +0,0 @@ -import Head from 'next/head' - -const rss = (lang, type, title) => ({ - title, - type: "application/rss+xml", - href: `/feeds/${type}-${lang}.rss.xml` -}) -const atom = (lang, type, title) => ({ - title, - type: "application/rss+atom", - href: `/feeds/${type}-${lang}.atom.xml` -}) -const json = (lang, type, title) => ({ - title, - type: "application/json", - href: `/feeds/${type}-${lang}.json` -}) - - -const feeds = { - en: [ - atom('en', 'blog', "Atom feed of FreeSewing.org blog posts"), - json('en', 'blog', "JSON feed of FreeSewing.org blog posts"), - rss( 'en', 'blog', "RSS feed of FreeSewing.org blog posts"), - atom('en', 'showcase', "Atom feed of FreeSewing.org showcase posts"), - json('en', 'showcase', "JSON feed of FreeSewing.org showcase posts"), - rss( 'en', 'showcase', "RSS feed of FreeSewing.org showcase posts"), - ], - de: [ - atom('de', 'blog', "Atom-Feed von FreeSewing.org-Blogbeiträgen"), - json('de', 'blog', "JSON-Feed von FreeSewing.org-Blogbeiträgen"), - rss( 'de', 'blog', "RSS-Feed von FreeSewing.org-Blogbeiträgen"), - atom('de', 'showcase', "Atom-Feed von FreeSewing.org-Galeriebeiträgen"), - json('de', 'showcase', "JSON-Feed von FreeSewing.org-Galeriebeiträgen"), - rss( 'de', 'showcase', "RSS-Feed von FreeSewing.org-Galeriebeiträgen"), - ], - es: [ - atom('es', 'blog', "Fuente Atom de las publicaciones del blog FreeSewing.org"), - json('es', 'blog', "Fuente JSON de las publicaciones del blog FreeSewing.org"), - rss( 'es', 'blog', "Fuente RSS de las publicaciones del blog FreeSewing.org"), - atom('es', 'showcase', "Fuente Atom de publicaciones de exhibición de FreeSewing.org"), - json('es', 'showcase', "Fuente JSON de publicaciones de exhibición de FreeSewing.org"), - rss( 'es', 'showcase', "Fuente RSS de publicaciones de exhibición de FreeSewing.org"), - ], - fr: [ - atom('fr', 'blog', "Flux Atom des articles du blog FreeSewing.org"), - json('fr', 'blog', "Flux JSON des articles du blog FreeSewing.org"), - rss( 'fr', 'blog', "Flux RSS des articles du blog FreeSewing.org"), - atom('fr', 'showcase', "Flux Atom des articles du galerie FreeSewing.org"), - json('fr', 'showcase', "Flux JSON des articles du galerie FreeSewing.org"), - rss( 'fr', 'showcase', "Flux RSS des articles du galerie FreeSewing.org"), - ], - nl: [ - atom('nl', 'blog', "Atom feed van FreeSewing.org blog posts"), - json('nl', 'blog', "JSON feed van FreeSewing.org blog posts"), - rss( 'nl', 'blog', "RSS feed van FreeSewing.org blog posts"), - atom('nl', 'showcase', "Atom feed van FreeSewing.org voorbeelden"), - json('nl', 'showcase', "JSON feed van FreeSewing.org voorbeelden"), - rss( 'nl', 'showcase', "RSS feed van FreeSewing.org voorbeelden"), - ], -} - - -const Feeds = ({ lang='en' }) => ( - - {feeds[lang].map(feed => )} - -) - -export default Feeds diff --git a/sites/org/components/feeds.mjs b/sites/org/components/feeds.mjs new file mode 100644 index 00000000000..f5e0c552f4d --- /dev/null +++ b/sites/org/components/feeds.mjs @@ -0,0 +1,68 @@ +import Head from 'next/head' + +const rss = (lang, type, title) => ({ + title, + type: 'application/rss+xml', + href: `/feeds/${type}-${lang}.rss.xml`, +}) +const atom = (lang, type, title) => ({ + title, + type: 'application/rss+atom', + href: `/feeds/${type}-${lang}.atom.xml`, +}) +const json = (lang, type, title) => ({ + title, + type: 'application/json', + href: `/feeds/${type}-${lang}.json`, +}) + +const feeds = { + en: [ + atom('en', 'blog', 'Atom feed of FreeSewing.org blog posts'), + json('en', 'blog', 'JSON feed of FreeSewing.org blog posts'), + rss('en', 'blog', 'RSS feed of FreeSewing.org blog posts'), + atom('en', 'showcase', 'Atom feed of FreeSewing.org showcase posts'), + json('en', 'showcase', 'JSON feed of FreeSewing.org showcase posts'), + rss('en', 'showcase', 'RSS feed of FreeSewing.org showcase posts'), + ], + de: [ + atom('de', 'blog', 'Atom-Feed von FreeSewing.org-Blogbeiträgen'), + json('de', 'blog', 'JSON-Feed von FreeSewing.org-Blogbeiträgen'), + rss('de', 'blog', 'RSS-Feed von FreeSewing.org-Blogbeiträgen'), + atom('de', 'showcase', 'Atom-Feed von FreeSewing.org-Galeriebeiträgen'), + json('de', 'showcase', 'JSON-Feed von FreeSewing.org-Galeriebeiträgen'), + rss('de', 'showcase', 'RSS-Feed von FreeSewing.org-Galeriebeiträgen'), + ], + es: [ + atom('es', 'blog', 'Fuente Atom de las publicaciones del blog FreeSewing.org'), + json('es', 'blog', 'Fuente JSON de las publicaciones del blog FreeSewing.org'), + rss('es', 'blog', 'Fuente RSS de las publicaciones del blog FreeSewing.org'), + atom('es', 'showcase', 'Fuente Atom de publicaciones de exhibición de FreeSewing.org'), + json('es', 'showcase', 'Fuente JSON de publicaciones de exhibición de FreeSewing.org'), + rss('es', 'showcase', 'Fuente RSS de publicaciones de exhibición de FreeSewing.org'), + ], + fr: [ + atom('fr', 'blog', 'Flux Atom des articles du blog FreeSewing.org'), + json('fr', 'blog', 'Flux JSON des articles du blog FreeSewing.org'), + rss('fr', 'blog', 'Flux RSS des articles du blog FreeSewing.org'), + atom('fr', 'showcase', 'Flux Atom des articles du galerie FreeSewing.org'), + json('fr', 'showcase', 'Flux JSON des articles du galerie FreeSewing.org'), + rss('fr', 'showcase', 'Flux RSS des articles du galerie FreeSewing.org'), + ], + nl: [ + atom('nl', 'blog', 'Atom feed van FreeSewing.org blog posts'), + json('nl', 'blog', 'JSON feed van FreeSewing.org blog posts'), + rss('nl', 'blog', 'RSS feed van FreeSewing.org blog posts'), + atom('nl', 'showcase', 'Atom feed van FreeSewing.org voorbeelden'), + json('nl', 'showcase', 'JSON feed van FreeSewing.org voorbeelden'), + rss('nl', 'showcase', 'RSS feed van FreeSewing.org voorbeelden'), + ], +} + +export const Feeds = ({ lang = 'en' }) => ( + + {feeds[lang].map((feed) => ( + + ))} + +) diff --git a/sites/org/components/footer/index.mjs b/sites/org/components/footer/index.mjs index 6fe4a77994e..32583cba989 100644 --- a/sites/org/components/footer/index.mjs +++ b/sites/org/components/footer/index.mjs @@ -1,20 +1,21 @@ -import Logo from 'shared/components/logos/freesewing.js' -import OsiLogo from 'shared/components/logos/osi.js' -import CreativeCommonsLogo from 'shared/components/logos/cc.js' -import CcByLogo from 'shared/components/logos/cc-by.js' -import Ribbon from 'shared/components/ribbon.js' import Link from 'next/link' -import { WordMark } from 'shared/components/wordmark.js' +import { FreeSewingLogo } from 'shared/components/logos/freesewing.mjs' +import { OsiLogo } from 'shared/components/logos/osi.mjs' +import { CCLogo } from 'shared/components/logos/cc.mjs' +import { CCByLogo } from 'shared/components/logos/cc-by.mjs' +import { Ribbon } from 'shared/components/ribbon.mjs' +import { WordMark } from 'shared/components/wordmark.mjs' import { useTranslation } from 'next-i18next' -import { freeSewingConfig } from 'site/freesewing.config.js' - -import HelpIcon from 'shared/components/icons/help.js' -import DiscordIcon from 'shared/components/icons/discord.js' -import FacebookIcon from 'shared/components/icons/facebook.js' -import GithubIcon from 'shared/components/icons/github.js' -import InstagramIcon from 'shared/components/icons/instagram.js' -import RedditIcon from 'shared/components/icons/reddit.js' -import TwitterIcon from 'shared/components/icons/twitter.js' +import { freeSewingConfig } from 'site/freesewing.config.mjs' +import { + HelpIcon, + DiscordIcon, + FacebookIcon, + GithubIcon, + InstagramIcon, + RedditIcon, + TwitterIcon, +} from 'shared/components/icons.mjs' const icon = { className: 'w-8 lg:w-12 h-8 lg:h-12' } const social = { @@ -60,10 +61,10 @@ export const Footer = ({ app }) => {
- +
- +

{t('cc')}

@@ -138,7 +139,7 @@ export const Footer = ({ app }) => { {/* Col 3 - Logo & Slogan */}
- +
diff --git a/sites/org/components/gdpr/details.js b/sites/org/components/gdpr/details.mjs similarity index 100% rename from sites/org/components/gdpr/details.js rename to sites/org/components/gdpr/details.mjs diff --git a/sites/org/components/header/index.mjs b/sites/org/components/header/index.mjs index c10e543d646..70597fcbe87 100644 --- a/sites/org/components/header/index.mjs +++ b/sites/org/components/header/index.mjs @@ -1,11 +1,9 @@ import { useState, useEffect } from 'react' -import ThemePicker, { ns as themeNs } from 'shared/components/theme-picker/index.js' -import LocalePicker, { ns as localeNs } from 'shared/components/locale-picker/index.js' -import CloseIcon from 'shared/components/icons/close.js' -import MenuIcon from 'shared/components/icons/menu.js' -import SearchIcon from 'shared/components/icons/search.js' -import Ribbon from 'shared/components/ribbon.js' -import { WordMark } from 'shared/components/wordmark.js' +import { ThemePicker, ns as themeNs } from 'shared/components/theme-picker/index.mjs' +import { LocalePicker, ns as localeNs } from 'shared/components/locale-picker/index.mjs' +import { CloseIcon, MenuIcon, SearchIcon } from 'shared/components/icons.mjs' +import { Ribbon } from 'shared/components/ribbon.mjs' +import { WordMark } from 'shared/components/wordmark.mjs' export const ns = [...new Set([...themeNs, ...localeNs])] diff --git a/sites/org/components/help-us.js b/sites/org/components/help-us.mjs similarity index 100% rename from sites/org/components/help-us.js rename to sites/org/components/help-us.mjs diff --git a/sites/org/components/layouts/bare.js b/sites/org/components/layouts/bare.js deleted file mode 100644 index b46e4fe6774..00000000000 --- a/sites/org/components/layouts/bare.js +++ /dev/null @@ -1,17 +0,0 @@ -import { useRouter } from 'next/router' -import Aside from 'shared/components/navigation/aside' -import ThemePicker from 'shared/components/theme-picker' - -const DefaultLayout = ({ app, children = [] }) => { - const router = useRouter() - const slug = router.asPath.slice(1) - - return ( - <> -
) } - -export default PageWrapper diff --git a/sites/org/components/wrappers/susi.js b/sites/org/components/wrappers/susi.mjs similarity index 88% rename from sites/org/components/wrappers/susi.js rename to sites/org/components/wrappers/susi.mjs index b93b4ce1405..370546ca3ec 100644 --- a/sites/org/components/wrappers/susi.js +++ b/sites/org/components/wrappers/susi.mjs @@ -5,7 +5,7 @@ const opacity = { lgbtq: 80, } -const SusiWrapper = ({ theme, children, error = false }) => ( +export const SusiWrapper = ({ theme, children, error = false }) => (
(
) - -export default SusiWrapper diff --git a/sites/org/components/wrappers/welcome.js b/sites/org/components/wrappers/welcome.mjs similarity index 75% rename from sites/org/components/wrappers/welcome.js rename to sites/org/components/wrappers/welcome.mjs index 3d6e1e6f5d7..23c331d9286 100644 --- a/sites/org/components/wrappers/welcome.js +++ b/sites/org/components/wrappers/welcome.mjs @@ -1,9 +1,7 @@ -const WelcomeWrapper = ({ children }) => ( +export const WelcomeWrapper = ({ children }) => (
{children}
) - -export default WelcomeWrapper diff --git a/sites/org/freesewing.config.js b/sites/org/freesewing.config.mjs similarity index 100% rename from sites/org/freesewing.config.js rename to sites/org/freesewing.config.mjs diff --git a/sites/org/hooks/useApp.js b/sites/org/hooks/useApp.mjs similarity index 98% rename from sites/org/hooks/useApp.js rename to sites/org/hooks/useApp.mjs index c6b559a1b29..b7cebef0ede 100644 --- a/sites/org/hooks/useApp.js +++ b/sites/org/hooks/useApp.mjs @@ -80,7 +80,7 @@ const buildNavigation = (lang, t) => { /* * The actual hook */ -function useApp({ bugsnag }) { +export function useApp({ bugsnag }) { // Load translation method const locale = useRouter().locale const { t } = useTranslation() @@ -183,5 +183,3 @@ function useApp({ bugsnag }) { errId, } } - -export default useApp diff --git a/sites/org/hooks/useBackend.js b/sites/org/hooks/useBackend.mjs similarity index 97% rename from sites/org/hooks/useBackend.js rename to sites/org/hooks/useBackend.mjs index 21d543b176b..2f1f29301d8 100644 --- a/sites/org/hooks/useBackend.js +++ b/sites/org/hooks/useBackend.mjs @@ -9,7 +9,7 @@ const api = axios.create({ timeout: 3000, }) -function useBackend(app) { +export function useBackend(app) { const auth = { headers: { Authorization: 'Bearer ' + app.token }, } @@ -107,5 +107,3 @@ function useBackend(app) { return backend } - -export default useBackend diff --git a/sites/org/notes.md b/sites/org/notes.md new file mode 100644 index 00000000000..ec48f879c4b --- /dev/null +++ b/sites/org/notes.md @@ -0,0 +1,3 @@ +to sit +bu hao yi se + diff --git a/sites/org/pages/_app.js b/sites/org/pages/_app.mjs similarity index 90% rename from sites/org/pages/_app.js rename to sites/org/pages/_app.mjs index 261ae28a4c7..eea99e4dcd2 100644 --- a/sites/org/pages/_app.js +++ b/sites/org/pages/_app.mjs @@ -3,7 +3,7 @@ import { appWithTranslation } from 'next-i18next' import React from 'react' import Bugsnag from '@bugsnag/js' import BugsnagPluginReact from '@bugsnag/plugin-react' -import { freeSewingConfig } from 'site/freesewing.config.js' +import { freeSewingConfig } from 'site/freesewing.config.mjs' Bugsnag.start({ apiKey: freeSewingConfig.bugsnag.key, diff --git a/sites/org/pages/confirm/signup/[...confirmation].js b/sites/org/pages/confirm/signup/[...confirmation].mjs similarity index 89% rename from sites/org/pages/confirm/signup/[...confirmation].js rename to sites/org/pages/confirm/signup/[...confirmation].mjs index e645ff1fd27..9d0c458fdb7 100644 --- a/sites/org/pages/confirm/signup/[...confirmation].js +++ b/sites/org/pages/confirm/signup/[...confirmation].mjs @@ -1,22 +1,24 @@ -import { useEffect } from 'react' -import Page from 'site/components/wrappers/page.js' -import useApp from 'site/hooks/useApp.js' -import useBackend from 'site/hooks/useBackend.js' -import { serverSideTranslations } from 'next-i18next/serverSideTranslations' -import { useTranslation } from 'next-i18next' -import Layout from 'site/components/layouts/bare' -import Link from 'next/link' -import { useState } from 'react' -import WelcomeWrapper from 'site/components/wrappers/welcome.js' -import Spinner from 'shared/components/icons/spinner.js' +// Hooks +import { useEffect, useState } from 'react' +import { useApp } from 'site/hooks/useApp.mjs' +import { useBackend } from 'site/hooks/useBackend.mjs' import { useRouter } from 'next/router' -import Popout from 'shared/components/popout.js' +import { useTranslation } from 'next-i18next' +// Dependencies +import { serverSideTranslations } from 'next-i18next/serverSideTranslations' +import Link from 'next/link' +// Components +import { PageWrapper } from 'site/components/wrappers/page.mjs' +import { BareLayout } from 'site/components/layouts/bare.mjs' +import { WelcomeWrapper } from 'site/components/wrappers/welcome.mjs' +import { Spinner } from 'shared/components/spinner.mjs' +import { Popout } from 'shared/components/popout.mjs' +import { Robot } from 'shared/components/robot/index.mjs' import { GdprProfileDetails, GdprMeasurementsDetails, ns as gdprNs, -} from 'site/components/gdpr/details.js' -import Robot from 'shared/components/robot/index.js' +} from 'site/components/gdpr/details.mjs' // Translation namespaces used on this page const ns = Array.from(new Set([...gdprNs, 'confirm', 'locales', 'themes'])) @@ -110,11 +112,11 @@ const ConfirmSignUpPage = (props) => { // Short-circuit errors if (error) return ( - + - + ) const partA = ( @@ -181,7 +183,7 @@ const ConfirmSignUpPage = (props) => { ) return ( - + {ready ? ( <> @@ -223,7 +225,7 @@ const ConfirmSignUpPage = (props) => {

-
+ ) } diff --git a/sites/org/pages/docs/[...mdxslug].js b/sites/org/pages/docs/[...mdxslug].mjs similarity index 88% rename from sites/org/pages/docs/[...mdxslug].js rename to sites/org/pages/docs/[...mdxslug].mjs index 9cb6447b477..8f602581448 100644 --- a/sites/org/pages/docs/[...mdxslug].js +++ b/sites/org/pages/docs/[...mdxslug].mjs @@ -1,14 +1,16 @@ -import Page from 'site/components/wrappers/page.js' -import useApp from 'site/hooks/useApp.js' -import mdxLoader from 'shared/mdx/loader' -import MdxWrapper from 'shared/components/wrappers/mdx' -import TocWrapper from 'shared/components/wrappers/toc' +// Hooks +import { useApp } from 'site/hooks/useApp.mjs' +// Dependencies import Head from 'next/head' import { serverSideTranslations } from 'next-i18next/serverSideTranslations' -import components from 'site/components/mdx/index.js' +import { mdxLoader } from 'shared/mdx/loader.mjs' import { jargon } from 'site/jargon.mjs' -// MDX paths -import mdxPaths from 'site/prebuild/mdx.paths.js' +import { mdxPaths } from 'site/prebuild/mdx.paths.mjs' +// Components +import { MdxWrapper } from 'shared/components/wrappers/mdx.mjs' +import { TocWrapper } from 'shared/components/wrappers/toc.mjs' +import { PageWrapper } from 'site/components/wrappers/page.mjs' +import { components } from 'site/components/mdx/index.mjs' const MdxPage = (props) => { // This hook is used for shared code and global state @@ -26,7 +28,7 @@ const MdxPage = (props) => { * active state */ return ( - + @@ -53,7 +55,7 @@ const MdxPage = (props) => { )}
- + ) } diff --git a/sites/org/pages/docs/index.js b/sites/org/pages/docs/index.mjs similarity index 78% rename from sites/org/pages/docs/index.js rename to sites/org/pages/docs/index.mjs index f2d75e8bd61..c9f93b30ea8 100644 --- a/sites/org/pages/docs/index.js +++ b/sites/org/pages/docs/index.mjs @@ -1,10 +1,13 @@ -import Page from 'site/components/wrappers/page.js' -import useApp from 'site/hooks/useApp.js' -import mdxLoader from 'shared/mdx/loader' -import MdxWrapper from 'shared/components/wrappers/mdx' -import ReadMore from 'shared/components/mdx/read-more.js' -import { jargon } from 'site/jargon.mjs' +// Hooks +import { useApp } from 'site/hooks/useApp.mjs' +// Dependencies import Head from 'next/head' +import mdxLoader from 'shared/mdx/loader' +// Components +import { PageWrapper } from 'site/components/wrappers/page.mjs' +import { MdxWrapper } from 'shared/components/wrappers/mdx.mjs' +import { ReadMore } from 'shared/components/mdx/read-more.mjs' +import { jargon } from 'site/jargon.mjs' const DocsPage = ({ title, mdx, bugsnag }) => { const app = useApp({ bugsnag }) @@ -16,14 +19,14 @@ const DocsPage = ({ title, mdx, bugsnag }) => { } return ( - + {fullTitle}
-
+ ) } diff --git a/sites/org/pages/index.js b/sites/org/pages/index.mjs similarity index 59% rename from sites/org/pages/index.js rename to sites/org/pages/index.mjs index 2d00b0bd6ca..0aba7858176 100644 --- a/sites/org/pages/index.js +++ b/sites/org/pages/index.mjs @@ -1,11 +1,14 @@ -import Page from 'site/components/wrappers/page.js' -import useApp from 'site/hooks/useApp.js' -import Popout from 'shared/components/popout.js' +// Hooks +import { useApp } from 'site/hooks/useApp.mjs' +// Dependencies import { serverSideTranslations } from 'next-i18next/serverSideTranslations' //import { useTranslation } from 'next-i18next' -import Layout from 'site/components/layouts/bare' -import PageLink from 'shared/components/page-link' import Head from 'next/head' +// Components +import { PageWrapper } from 'site/components/wrappers/page.mjs' +import { Popout } from 'shared/components/popout.mjs' +import { BareLayout } from 'site/components/layouts/bare.mjs' +import { PageLink } from 'shared/components/page-link.mjs' const HomePage = (props) => { const app = useApp(props) @@ -14,18 +17,18 @@ const HomePage = (props) => { // const { t } = useTranslation(['homepage', 'ograph']) return ( - + {title}
- Create homepage. Meanwhile check + Create homepage. Meanwhile check
-
+ ) } diff --git a/sites/org/pages/signin/index.js b/sites/org/pages/signin/index.mjs similarity index 89% rename from sites/org/pages/signin/index.js rename to sites/org/pages/signin/index.mjs index 8879c479521..f7dc017a370 100644 --- a/sites/org/pages/signin/index.js +++ b/sites/org/pages/signin/index.mjs @@ -1,12 +1,15 @@ -import Page from 'site/components/wrappers/page.js' -import useApp from 'site/hooks/useApp.js' -import { serverSideTranslations } from 'next-i18next/serverSideTranslations' +// Hooks +import { useApp } from 'site/hooks/useApp.mjs' import { useTranslation } from 'next-i18next' -import Layout from 'site/components/layouts/bare' -import Link from 'next/link' import { useState } from 'react' +// Dependencies +import { serverSideTranslations } from 'next-i18next/serverSideTranslations' import { validateEmail, validateTld } from 'shared/utils.mjs' -import SusiWrapper from 'site/components/wrappers/susi.js' +// Components +import Link from 'next/link' +import { PageWrapper } from 'site/components/wrappers/page.mjs' +import { BareLayout } from 'site/components/layouts/bare.mjs' +import { SusiWrapper } from 'site/components/wrappers/susi.mjs' const darkLinkClasses = 'decoration-1 underline text-medium font-medium hover:decoration-2' @@ -29,7 +32,7 @@ const SignInPage = (props) => { const clearUsername = () => app.setUsername(false) return ( - +

{t('welcomeName', { name: app.username || '' })} @@ -82,7 +85,7 @@ const SignInPage = (props) => {

- + ) } diff --git a/sites/org/pages/signup/index.js b/sites/org/pages/signup/index.mjs similarity index 90% rename from sites/org/pages/signup/index.js rename to sites/org/pages/signup/index.mjs index 300edb68bbe..414a17f447d 100644 --- a/sites/org/pages/signup/index.js +++ b/sites/org/pages/signup/index.mjs @@ -1,15 +1,18 @@ -import Page from 'site/components/wrappers/page.js' -import useApp from 'site/hooks/useApp.js' -import useBackend from 'site/hooks/useBackend.js' -import { serverSideTranslations } from 'next-i18next/serverSideTranslations' -import { useTranslation } from 'next-i18next' -import Layout from 'site/components/layouts/bare' -import Link from 'next/link' +// Hooks import { useState } from 'react' +import { useApp } from 'site/hooks/useApp.mjs' +import { useBackend } from 'site/hooks/useBackend.mjs' +import { useTranslation } from 'next-i18next' +// Dependencies +import { serverSideTranslations } from 'next-i18next/serverSideTranslations' import { validateEmail, validateTld } from 'shared/utils.mjs' -import SusiWrapper from 'site/components/wrappers/susi.js' -import Spinner from 'shared/components/icons/spinner.js' -import Robot from 'shared/components/robot/index.js' +// Components +import Link from 'next/link' +import { PageWrapper } from 'site/components/wrappers/page.mjs' +import { BareLayout } from 'site/components/layouts/bare.mjs' +import { SusiWrapper } from 'site/components/wrappers/susi.mjs' +import { Spinner } from 'shared/components/spinner.mjs' +import { Robot } from 'shared/components/robot/index.mjs' // Translation namespaces used on this page const namespaces = ['signup', 'errors'] @@ -59,7 +62,7 @@ const SignUpPage = (props) => { const loadingClasses = app.loading ? 'opacity-50' : '' return ( - +

{result ? ( @@ -152,7 +155,7 @@ const SignUpPage = (props) => { )} - + ) } diff --git a/sites/org/pages/typography.js b/sites/org/pages/typography.mjs similarity index 92% rename from sites/org/pages/typography.js rename to sites/org/pages/typography.mjs index 28767bdc203..aca1d8a4c4f 100644 --- a/sites/org/pages/typography.js +++ b/sites/org/pages/typography.mjs @@ -1,6 +1,8 @@ -import Page from 'site/components/wrappers/page.js' -import useApp from 'site/hooks/useApp.js' -import Popout from 'shared/components/popout.js' +// Hooks +import { useApp } from 'site/hooks/useApp.mjs' +// Components +import { PageWrapper } from 'site/components/wrappers/page.mjs' +import { Popout } from 'shared/components/popout.mjs' const TypographyPage = (props) => { const app = useApp(props) @@ -13,7 +15,7 @@ const TypographyPage = (props) => { ) return ( - +

This typography page shows an overview of different elements and how they are styled.

It's a good starting point for theme development.

@@ -84,7 +86,7 @@ const TypographyPage = (props) => { ) })}
-
+ ) } diff --git a/sites/org/pages/welcome/bio.js b/sites/org/pages/welcome/bio.mjs similarity index 53% rename from sites/org/pages/welcome/bio.js rename to sites/org/pages/welcome/bio.mjs index e5265843f23..c56030316e8 100644 --- a/sites/org/pages/welcome/bio.js +++ b/sites/org/pages/welcome/bio.mjs @@ -1,10 +1,13 @@ -import Page from 'site/components/wrappers/page.js' -import useApp from 'site/hooks/useApp.js' -import { serverSideTranslations } from 'next-i18next/serverSideTranslations' +// Hooks +import { useApp } from 'site/hooks/useApp.mjs' import { useTranslation } from 'next-i18next' -import Layout from 'site/components/layouts/bare' -import AuthWrapper, { namespaces as authNs } from 'site/components/wrappers/auth/index.js' -import BioSettings, { namespaces as bioNs } from 'site/components/account/bio/index.js' +// Dependencies +import { serverSideTranslations } from 'next-i18next/serverSideTranslations' +// Components +import { PageWrapper } from 'site/components/wrappers/page.mjs' +import { BareLayout } from 'site/components/layouts/bare.mjs' +import { AuthWrapper, ns as authNs } from 'site/components/wrappers/auth/index.mjs' +import { BioSettings, ns as bioNs } from 'site/components/account/bio/index.mjs' // Translation namespaces used on this page const namespaces = [...bioNs, ...authNs] @@ -14,13 +17,13 @@ const BioPage = (props) => { const { t } = useTranslation(namespaces) return ( - +
-
+ ) } @@ -29,7 +32,7 @@ export default BioPage export async function getStaticProps({ locale }) { return { props: { - ...(await serverSideTranslations(locale)), + ...(await serverSideTranslations(locale, namespaces)), }, } } diff --git a/sites/org/pages/welcome/compare.js b/sites/org/pages/welcome/compare.mjs similarity index 53% rename from sites/org/pages/welcome/compare.js rename to sites/org/pages/welcome/compare.mjs index fc843752f82..8e8b0e0d93b 100644 --- a/sites/org/pages/welcome/compare.js +++ b/sites/org/pages/welcome/compare.mjs @@ -1,10 +1,13 @@ -import Page from 'site/components/wrappers/page.js' -import useApp from 'site/hooks/useApp.js' -import { serverSideTranslations } from 'next-i18next/serverSideTranslations' +// Hooks +import { useApp } from 'site/hooks/useApp.mjs' import { useTranslation } from 'next-i18next' -import Layout from 'site/components/layouts/bare' -import AuthWrapper, { namespaces as authNs } from 'site/components/wrappers/auth/index.js' -import CompareSettings, { namespaces as compareNs } from 'site/components/account/compare/index.js' +// Dependencies +import { serverSideTranslations } from 'next-i18next/serverSideTranslations' +// Components +import { PageWrapper } from 'site/components/wrappers/page.mjs' +import { BareLayout } from 'site/components/layouts/bare.mjs' +import { AuthWrapper, ns as authNs } from 'site/components/wrappers/auth/index.mjs' +import { CompareSettings, ns as compareNs } from 'site/components/account/compare/index.mjs' // Translation namespaces used on this page const namespaces = [...compareNs, ...authNs] @@ -14,13 +17,13 @@ const ComparePage = (props) => { const { t } = useTranslation(namespaces) return ( - +
-
+ ) } @@ -29,7 +32,7 @@ export default ComparePage export async function getStaticProps({ locale }) { return { props: { - ...(await serverSideTranslations(locale)), + ...(await serverSideTranslations(locale, namespaces)), }, } } diff --git a/sites/org/pages/welcome/img.js b/sites/org/pages/welcome/img.mjs similarity index 53% rename from sites/org/pages/welcome/img.js rename to sites/org/pages/welcome/img.mjs index 08ae90f0990..b9d6efbb622 100644 --- a/sites/org/pages/welcome/img.js +++ b/sites/org/pages/welcome/img.mjs @@ -1,10 +1,13 @@ -import Page from 'site/components/wrappers/page.js' -import useApp from 'site/hooks/useApp.js' -import { serverSideTranslations } from 'next-i18next/serverSideTranslations' +// Hooks +import { useApp } from 'site/hooks/useApp.mjs' import { useTranslation } from 'next-i18next' -import Layout from 'site/components/layouts/bare' -import AuthWrapper, { namespaces as authNs } from 'site/components/wrappers/auth/index.js' -import ImgSettings, { namespaces as imgNs } from 'site/components/account/img/index.js' +// Dependencies +import { serverSideTranslations } from 'next-i18next/serverSideTranslations' +// Components +import { PageWrapper } from 'site/components/wrappers/page.mjs' +import { BareLayout } from 'site/components/layouts/bare.mjs' +import { AuthWrapper, ns as authNs } from 'site/components/wrappers/auth/index.mjs' +import { ImgSettings, ns as imgNs } from 'site/components/account/img/index.mjs' // Translation namespaces used on this page const namespaces = [...imgNs, ...authNs] @@ -14,13 +17,13 @@ const ImgPage = (props) => { const { t } = useTranslation(namespaces) return ( - +
-
+ ) } @@ -29,7 +32,7 @@ export default ImgPage export async function getStaticProps({ locale }) { return { props: { - ...(await serverSideTranslations(locale)), + ...(await serverSideTranslations(locale, namespaces)), }, } } diff --git a/sites/org/pages/welcome/index.js b/sites/org/pages/welcome/index.mjs similarity index 53% rename from sites/org/pages/welcome/index.js rename to sites/org/pages/welcome/index.mjs index 58cb122f9b1..c52fc2d196c 100644 --- a/sites/org/pages/welcome/index.js +++ b/sites/org/pages/welcome/index.mjs @@ -1,10 +1,13 @@ -import Page from 'site/components/wrappers/page.js' -import useApp from 'site/hooks/useApp.js' -import { serverSideTranslations } from 'next-i18next/serverSideTranslations' +// Hooks +import { useApp } from 'site/hooks/useApp.mjs' import { useTranslation } from 'next-i18next' -import Layout from 'site/components/layouts/bare' -import AuthWrapper, { namespaces as authNs } from 'site/components/wrappers/auth/index.js' -import ControlSettings, { namespaces as controlNs } from 'site/components/account/control/index.js' +// Dependencies +import { serverSideTranslations } from 'next-i18next/serverSideTranslations' +// Components +import { PageWrapper } from 'site/components/wrappers/page.mjs' +import { BareLayout } from 'site/components/layouts/bare.mjs' +import { AuthWrapper, ns as authNs } from 'site/components/wrappers/auth/index.mjs' +import { ControlSettings, ns as controlNs } from 'site/components/account/control/index.mjs' // Translation namespaces used on this page const namespaces = [...controlNs, ...authNs] @@ -14,13 +17,13 @@ const WelcomePage = (props) => { const { t } = useTranslation(namespaces) return ( - +
-
+ ) } @@ -29,7 +32,7 @@ export default WelcomePage export async function getStaticProps({ locale }) { return { props: { - ...(await serverSideTranslations(locale)), + ...(await serverSideTranslations(locale, namespaces)), }, } } diff --git a/sites/org/pages/welcome/newsletter.js b/sites/org/pages/welcome/newsletter.mjs similarity index 55% rename from sites/org/pages/welcome/newsletter.js rename to sites/org/pages/welcome/newsletter.mjs index f40f2d092d6..c0b753a9587 100644 --- a/sites/org/pages/welcome/newsletter.js +++ b/sites/org/pages/welcome/newsletter.mjs @@ -1,12 +1,15 @@ -import Page from 'site/components/wrappers/page.js' -import useApp from 'site/hooks/useApp.js' -import { serverSideTranslations } from 'next-i18next/serverSideTranslations' +// Hooks +import { useApp } from 'site/hooks/useApp.mjs' import { useTranslation } from 'next-i18next' -import Layout from 'site/components/layouts/bare' -import AuthWrapper, { namespaces as authNs } from 'site/components/wrappers/auth/index.js' +// Dependencies +import { serverSideTranslations } from 'next-i18next/serverSideTranslations' +// Components +import { PageWrapper } from 'site/components/wrappers/page.mjs' +import { BareLayout } from 'site/components/layouts/bare.mjs' +import { AuthWrapper, ns as authNs } from 'site/components/wrappers/auth/index.mjs' import NewsletterSettings, { - namespaces as newsletterNs, -} from 'site/components/account/newsletter/index.js' + ns as newsletterNs, +} from 'site/components/account/newsletter/index.mjs' // Translation namespaces used on this page const namespaces = [...newsletterNs, ...authNs] @@ -16,13 +19,13 @@ const WelcomePage = (props) => { const { t } = useTranslation(namespaces) return ( - +
-
+ ) } @@ -31,7 +34,7 @@ export default WelcomePage export async function getStaticProps({ locale }) { return { props: { - ...(await serverSideTranslations(locale)), + ...(await serverSideTranslations(locale, namespaces)), }, } } diff --git a/sites/org/pages/welcome/units.js b/sites/org/pages/welcome/units.mjs similarity index 53% rename from sites/org/pages/welcome/units.js rename to sites/org/pages/welcome/units.mjs index 340cd3331be..fde0bd9e110 100644 --- a/sites/org/pages/welcome/units.js +++ b/sites/org/pages/welcome/units.mjs @@ -1,10 +1,13 @@ -import Page from 'site/components/wrappers/page.js' -import useApp from 'site/hooks/useApp.js' -import { serverSideTranslations } from 'next-i18next/serverSideTranslations' +// Hooks +import { useApp } from 'site/hooks/useApp.mjs' import { useTranslation } from 'next-i18next' -import Layout from 'site/components/layouts/bare' -import AuthWrapper, { namespaces as authNs } from 'site/components/wrappers/auth/index.js' -import UnitsSettings, { namespaces as unitsNs } from 'site/components/account/units/index.js' +// Dependencies +import { serverSideTranslations } from 'next-i18next/serverSideTranslations' +// Components +import { PageWrapper } from 'site/components/wrappers/page.mjs' +import { BareLayout } from 'site/components/layouts/bare.mjs' +import { AuthWrapper, ns as authNs } from 'site/components/wrappers/auth/index.mjs' +import { UnitsSettings, ns as unitsNs } from 'site/components/account/units/index.mjs' // Translation namespaces used on this page const namespaces = [...unitsNs, ...authNs] @@ -14,13 +17,13 @@ const UnitsPage = (props) => { const { t } = useTranslation(namespaces) return ( - +
-
+ ) } @@ -29,7 +32,7 @@ export default UnitsPage export async function getStaticProps({ locale }) { return { props: { - ...(await serverSideTranslations(locale)), + ...(await serverSideTranslations(locale, namespaces)), }, } } diff --git a/sites/org/pages/welcome/username.js b/sites/org/pages/welcome/username.mjs similarity index 53% rename from sites/org/pages/welcome/username.js rename to sites/org/pages/welcome/username.mjs index 3fd17127ba0..5548ce3737c 100644 --- a/sites/org/pages/welcome/username.js +++ b/sites/org/pages/welcome/username.mjs @@ -1,12 +1,13 @@ -import Page from 'site/components/wrappers/page.js' -import useApp from 'site/hooks/useApp.js' -import { serverSideTranslations } from 'next-i18next/serverSideTranslations' +// Hooks +import { useApp } from 'site/hooks/useApp.mjs' import { useTranslation } from 'next-i18next' -import Layout from 'site/components/layouts/bare' -import AuthWrapper, { namespaces as authNs } from 'site/components/wrappers/auth/index.js' -import UsernameSettings, { - namespaces as usernameNs, -} from 'site/components/account/username/index.js' +// Dependencies +import { serverSideTranslations } from 'next-i18next/serverSideTranslations' +// Components +import { PageWrapper } from 'site/components/wrappers/page.mjs' +import { BareLayout } from 'site/components/layouts/bare.mjs' +import { AuthWrapper, ns as authNs } from 'site/components/wrappers/auth/index.mjs' +import { UsernameSettings, ns as usernameNs } from 'site/components/account/username/index.mjs' // Translation namespaces used on this page const namespaces = [...usernameNs, ...authNs] @@ -16,13 +17,13 @@ const UsernamePage = (props) => { const { t } = useTranslation(namespaces) return ( - +
-
+ ) } @@ -31,7 +32,7 @@ export default UsernamePage export async function getStaticProps({ locale }) { return { props: { - ...(await serverSideTranslations(locale)), + ...(await serverSideTranslations(locale, namespaces)), }, } } diff --git a/sites/shared/components/breadcrumbs.js b/sites/shared/components/breadcrumbs.mjs similarity index 83% rename from sites/shared/components/breadcrumbs.js rename to sites/shared/components/breadcrumbs.mjs index 8c6be43924b..d2af7575e00 100644 --- a/sites/shared/components/breadcrumbs.js +++ b/sites/shared/components/breadcrumbs.mjs @@ -1,8 +1,7 @@ -import React from 'react' import Link from 'next/link' -import FreeSewingIcon from 'shared/components/icons.mjs' +import { FreeSewingIcon } from 'shared/components/icons.mjs' -const Breadcrumbs = ({ crumbs = [], title }) => +export const Breadcrumbs = ({ crumbs = [], title }) => crumbs ? (
  • @@ -30,5 +29,3 @@ const Breadcrumbs = ({ crumbs = [], title }) => ))}
) : null - -export default Breadcrumbs diff --git a/sites/shared/components/code.js b/sites/shared/components/code.mjs similarity index 55% rename from sites/shared/components/code.js rename to sites/shared/components/code.mjs index d20979b734b..c50925e1128 100644 --- a/sites/shared/components/code.js +++ b/sites/shared/components/code.mjs @@ -1,5 +1,3 @@ -const Code = ({ children }) => ( +export const Code = ({ children = null }) => ( {children} ) - -export default Code diff --git a/sites/shared/components/copy-to-clipboard.js b/sites/shared/components/copy-to-clipboard.mjs similarity index 74% rename from sites/shared/components/copy-to-clipboard.js rename to sites/shared/components/copy-to-clipboard.mjs index 443940a25b1..8ba5f9594ca 100644 --- a/sites/shared/components/copy-to-clipboard.js +++ b/sites/shared/components/copy-to-clipboard.mjs @@ -1,7 +1,7 @@ import ReactDOMServer from 'react-dom/server' import { useState } from 'react' import { CopyIcon } from 'shared/components/icons.mjs' -import { CopyToClipboard } from 'react-copy-to-clipboard' +import { CopyToClipboard as Copy } from 'react-copy-to-clipboard' const strip = (html) => typeof DOMParser === 'undefined' @@ -13,19 +13,17 @@ const handleCopied = (setCopied) => { setTimeout(() => setCopied(false), 1000) } -const CopyToClipboardIcon = ({ content }) => { +export const CopyToClipboard = ({ content }) => { const [copied, setCopied] = useState(false) const text = typeof content === 'string' ? content : strip(ReactDOMServer.renderToStaticMarkup(content)) return ( - handleCopied(setCopied)}> + handleCopied(setCopied)}> - + ) } - -export default CopyToClipboardIcon diff --git a/sites/shared/components/docs-link.js b/sites/shared/components/docs-link.mjs similarity index 52% rename from sites/shared/components/docs-link.js rename to sites/shared/components/docs-link.mjs index 6c47738c095..2661396cb22 100644 --- a/sites/shared/components/docs-link.js +++ b/sites/shared/components/docs-link.mjs @@ -1,12 +1,8 @@ -import PageLink from './page-link' +import PageLink from './page-link.mjs' import get from 'lodash.get' -import useApp from 'site/hooks/useApp' +import useApp from 'site/hooks/useApp.mjs' -const DocsLink = ({ slug }) => { +export const DocsLink = ({ slug }) => { const app = useApp() return } - -export default DocsLink - - diff --git a/sites/shared/components/error/error-boundary.js b/sites/shared/components/error/error-boundary.mjs similarity index 90% rename from sites/shared/components/error/error-boundary.js rename to sites/shared/components/error/error-boundary.mjs index ac6c2367d42..41cdf1cb26c 100644 --- a/sites/shared/components/error/error-boundary.js +++ b/sites/shared/components/error/error-boundary.mjs @@ -1,7 +1,7 @@ import React from 'react' -import ResetButtons from './reset-buttons' +import { ResetButtons } from './reset-buttons' import { LogGroup } from 'shared/components/workbench/logs' -import DefaultErrorView from './view' +import { ErrorView as DefaultErrorView } from './view' const ErrorView = (props) => { if (props.children) return props.children @@ -22,7 +22,7 @@ const ErrorView = (props) => { ) } -class ErrorBoundary extends React.Component { +export class ErrorBoundary extends React.Component { constructor(props) { super(props) this.state = { hasError: false } @@ -65,5 +65,3 @@ class ErrorBoundary extends React.Component { } } } - -export default ErrorBoundary diff --git a/sites/shared/components/error/reset-buttons.js b/sites/shared/components/error/reset-buttons.js deleted file mode 100644 index 714644751c6..00000000000 --- a/sites/shared/components/error/reset-buttons.js +++ /dev/null @@ -1,10 +0,0 @@ -import { useTranslation } from 'next-i18next' - -export default function ({resetGist, undoGist}) { - const {t} = useTranslation(['app']) - - return (
- - -
-)} diff --git a/sites/shared/components/error/reset-buttons.mjs b/sites/shared/components/error/reset-buttons.mjs new file mode 100644 index 00000000000..a45cf19fe85 --- /dev/null +++ b/sites/shared/components/error/reset-buttons.mjs @@ -0,0 +1,18 @@ +import { useTranslation } from 'next-i18next' + +// FIXME: I feel this should be kept closer to where it's used + +export const ResetButtons = ({ resetGist, undoGist }) => { + const { t } = useTranslation(['app']) + + return ( +
+ + +
+ ) +} diff --git a/sites/shared/components/error/view.js b/sites/shared/components/error/view.js deleted file mode 100644 index fda20b980f9..00000000000 --- a/sites/shared/components/error/view.js +++ /dev/null @@ -1,59 +0,0 @@ -import Robot from 'shared/components/robot/index.js' -import Popout from 'shared/components/popout.js' -import { useTranslation } from 'next-i18next' -import { useState } from 'react' - -const Error = ({ children, inspectChildren}) => { - - const { t } = useTranslation(['errors']) - const [share, setShare] = useState(false) - - return ( -
- -
-
-

{t('errors:something')}

- {children} -
- -
-
- -

Would you like to report this problem?

-

- You can help us make FreeSewing better by reporting this problem. -

-

If you choose to report this:

-
    -
  • - We will compile a crash report that contains everything needed to recreate this problem -
  • -
  • - We will include personal data such as your username, - email address and measurements -
  • -
  • - We will share this report and the data in it with FreeSewing's bughunters team who will investigate the problem on your behalf -
  • -
  • Your personal data will not be shared publicly
  • -
-
- -
-

- -

-

- If you prefer not to share any info, or want to investigate the problem yourself, you can do so: -

- {inspectChildren} -
-
) -} - -export default Error diff --git a/sites/shared/components/error/view.mjs b/sites/shared/components/error/view.mjs new file mode 100644 index 00000000000..d078c292934 --- /dev/null +++ b/sites/shared/components/error/view.mjs @@ -0,0 +1,76 @@ +import { useTranslation } from 'next-i18next' +import { useState } from 'react' +import { Robot } from 'shared/components/robot/index.mjs' +import { Popout } from 'shared/components/popout.mjs' + +export const ErrorView = ({ children, inspectChildren }) => { + const { t } = useTranslation(['errors']) + const [share, setShare] = useState(false) + + return ( +
+ +
+
+

{t('errors:something')}

+ {children} +
+ +
+
+ +

Would you like to report this problem?

+

+ You can help us make FreeSewing better by reporting this problem. +

+

If you choose to report this:

+
    +
  • + We will compile a crash report that contains everything needed{' '} + to recreate this problem +
  • +
  • + We will include personal data such as your username,{' '} + email address and measurements +
  • +
  • + We will share this report and the data in it with{' '} + + FreeSewing's bughunters team + {' '} + who will investigate the problem on your behalf +
  • +
  • + Your personal data will not be shared publicly +
  • +
+
+ +
+

+ +

+

+ If you prefer not to share any info, or want to investigate the problem yourself, you can + do so: +

+ {inspectChildren} +
+
+ ) +} diff --git a/sites/shared/components/icons.mjs b/sites/shared/components/icons.mjs index 1565fc153b5..0cd0a2ec2f4 100644 --- a/sites/shared/components/icons.mjs +++ b/sites/shared/components/icons.mjs @@ -1,7 +1,14 @@ -export const IconWrapper = ({ className = 'w-6 h-6', stroke = 2, children = null }) => ( +import { logoPath } from 'shared/components/logos/freesewing.mjs' + +export const IconWrapper = ({ + className = 'w-6 h-6', + stroke = 2, + children = null, + fill = false, +}) => ( ( ) export const DiscordIcon = (props) => ( - + ) @@ -124,23 +131,26 @@ export const ExportIcon = (props) => ( ) +export const FacebookIcon = (props) => ( + + + +) + export const FilterIcon = (props) => ( ) -export const logoPath = - 'm18.56 0c-0.4945 0.3515-0.469 0.3065-0.8685 0.437-0.916 0.2995-1.7945 0.135-2.837 0.048-0.3135-0.035-0.6245-0.0555-0.928-0.0575-1.5325-0.0105-2.834 0.439-3.0805 1.694-0.4545 0.2755-0.8725 0.609-1.2865 0.943-0.884 0.6975-1.5495 1.55-2.0035 2.5775-0.62 1.5175-0.06 3.146 0.2175 4.684 0.066 0.36 0.135 0.703 0.172 0.8355 0.0525 0.1865 0.145 0.3645 0.2455 0.5245 0.0235 4e-3 0.1475-0.187 0.177-0.2715 0.043-0.123 0.0385-0.3205-0.0085-0.4905-0.104-0.3825-0.203-0.693-0.2115-0.849-0.015-0.293 0.042-0.5635 0.149-0.6975 0.038-0.0475 0.125 0.1975 0.1025 0.2885-0.0265 0.1095-0.0465 0.297-0.038 0.3835 0.0235 0.293 0.0665 0.6065 0.12 0.8805 0.0685 0.3535 0.098 0.5805 0.0855 0.6685-9e-3 0.064-0.039 0.1285-0.154 0.3265-0.1 0.1735-0.152 0.314-0.16 0.438-0.0085 0.121 0.028 0.4235 0.062 0.4975 0.0495 0.1155 0.1985 0.237 0.3285 0.267 0.1245 0.0475 0.187 0.146 0.251 0.2565 0.1555 0.2965 0.2755 0.6575 0.3945 1.2015 0.058 0.2605 0.1065 0.493 0.122 0.615-0.96 1e-3 -2.1895 0.0015-3.3095 0.0015-0.377 6e-3 -1.058-0.171-1.6825-0.212-0.0905-0.977-0.5195-2.112-1.2535-2.178-0.501-0.0455-0.9165 0.145-1.268 0.9365l0.01 0.0425c0.2075-0.1735 0.4265-0.704 1.2155-0.6675 0.606 0.0275 0.808 1.1745 0.868 1.8645-0.369 0.027-0.683 0.1405-0.847 0.424h-0.0035c0 5e-4 0 0.0015 0.0015 0.0025-0.0015 1e-3 -0.0015 2e-3 -0.0015 3e-3h0.0035c0.169 0.2905 0.4945 0.403 0.877 0.4255 0.2555 7.225 7.047 8.157 8.903 8.157 6.924 0 9.348-4.705 9.7125-6.5685 0.1705 0.794-0.3665 1.8055-0.495 2.552 1.4605-1.6885 1.1965-3.312 0.9295-4.945 0.222 0.264 0.5225 0.4275 0.93 0.337-0.2905-0.194-0.6845-0.058-0.9205-0.8765-0.103-0.3535-0.192-0.6185-0.2805-0.841-0.191-0.7165-0.462-1.401-0.795-2.068-0.281-0.7235-0.0955-1.1925-0.1235-1.8135 0.5055 1.667 0.8215 2.1105 1.4115 2.285-1.484-1.788-0.976-4.5565-1.8145-7.0275 0.3795 0.223 0.8125 0.29 1.2735 0.0175-0.446-0.127-0.891 0.2085-1.531-0.732-0.5405-1.0515-1.3235-1.828-2.2735-2.513-0.509-0.332-1.074-0.555-1.642-0.762 0.5785-0.145 1.2245-0.66 1.2545-1.0445zm-0.9705 5.5535c0.762 0.278 1.602 1.334 1.5925 2.37v0.058c-0.0205 1.407-0.66 2.1635-0.633 3.1005 0.0345 1.1035 0.5095 1.4885 0.604 1.6725-0.162-0.6805-0.257-1.5365-0.043-2.2145 0.275-0.872 0.5525-1.594 0.5325-2.277-0.01-0.16-0.078-0.7585-0.1235-1.0235 0.817 1.179-0.177 2.8935 0.109 4.0155 0.497 1.9545 2.7245 2.2015 2.0615 6.1395-0.5835 3.462-4.5815 6.0895-8.6795 6.0895-3.038 0-8.3025-1.6815-8.5625-7.646 0.6175-0.044 1.2815-0.216 1.654-0.21 1.126 0 2.412 5e-4 3.381 1e-3 0.182 0.821 0.3185 1.019 1.009 1.566 0.768 0.604 0.947 0.6775 2.083 0.6885 1.1365 0.0115 1.4735-0.232 2.576-1.275 0.238-0.279 0.341-0.6445 0.4565-0.988 1.134-0.0105 1.961-0.0305 2.7745-0.0685 0.8285-0.0375 0.9455 0 2.2805-0.1375-1.335-0.1375-1.452-0.1-2.2805-0.138-0.792-0.036-1.594-0.0565-2.6785-0.0665 0.091-0.4085 0.221-0.8075 0.3595-1.202 0.0855-0.2325 0.186-0.459 0.289-0.6845l0.1125-0.035c0.217-0.077 0.409-0.242 0.4855-0.465 0.0985-0.2955 0.0285-0.6275-0.162-0.869-0.0655-0.0905-0.147-0.206-0.1805-0.257-0.1005-0.159-0.103-0.2475-0.018-0.8385 0.0715-0.495 0.0795-0.754 0.03-1.005-0.01-0.1435-0.011-0.4385-0.0155-0.518 0.038 0.021 0.1205 0.209 0.204 0.4635 0.083 0.2555 0.0965 0.3085 0.1155 0.526 0.021 0.247-0.0715 0.43-0.1475 0.7985-0.038 0.19-0.0715 0.3665-0.0715 0.3905 0 0.0255 0.018 0.0795 0.037 0.1215 0.0445 0.094 0.128 0.226 0.1435 0.226 0.2725-0.3005 0.4325-0.6715 0.575-1.048 0.15-0.426 0.194-0.878 0.299-1.3165 0.085-0.382 0.183-0.7645 0.2135-1.1565 0.0615-0.765 0.0255-1.305-0.1435-2.102-0.0405-0.18-0.1575-0.5235-0.239-0.6855zm-2.68 3.7685c0.2925-0.0035 0.582 0.032 0.8575 0.1115 0.3745 0.1435 0.427 0.478 0.496 0.8535 0.0385 0.24 0.037 0.4125-0.0065 0.6945-0.0305 0.409-0.193 0.7255-0.548 0.948-0.5355 0.099-1.108 0.1945-1.562-0.16-0.381-0.525-0.6105-1.1885-0.523-1.8355 0.0555-0.2655 0.179-0.4035 0.433-0.486 0.2735-0.0785 0.563-0.1215 0.853-0.126zm-4.4415 0.0475c0.2735-0.0025 0.55 0.0265 0.702 0.1235 0.6525 0.4415 0.443 1.16 0.185 1.7905-0.3755 0.8255-1.1875 0.795-1.9745 0.7885-0.4355-0.1275-0.4755-0.4845-0.5385-0.866-0.054-0.3685-0.169-0.7635-0.073-1.134 0.2465-0.596 1.1475-0.6645 1.699-0.7025zm9.9515 0.103c0.0035 1.5865 0.2745 2.366 0.8185 3.4895-0.3205-0.6115-0.7785-0.9595-0.949-1.6905-0.326-1.4115 0.0255-1.3325 0.1305-1.799zm-7.9065 1.149c0.086 0.087 0.1275 0.207 0.202 0.3025 0.0575-0.0985 0.1165-0.1965 0.1905-0.284 0.0385 1e-3 0.0855 0.077 0.128 0.213 0.182 0.503 0.2175 1.0565 0.4535 1.54 0.2205 0.35-0.0805 0.554-0.411 0.57-0.241-5e-4 -0.343-0.165-0.4845-0.328-0.0365 0.1065-0.106 0.175-0.189 0.247-0.211 0.177-0.6245 0.1115-0.6885-0.1675 0.085-0.533 0.3565-1.0225 0.5345-1.5335 0.0885-0.1865 0.0895-0.3295 0.2645-0.5595zm-3.096 2.6925c0.1065 0 0.399 0.1985 0.4585 0.3105 0.041 0.0745 0.1345 0.3645 0.141 0.435 0.0105 0.084-0.015 0.283-0.041 0.337-0.019 0.0385-0.0335 0.044-0.0555 0.019-0.0185-0.021-0.2635-0.491-0.42-0.802-0.123-0.249-0.136-0.2995-0.083-0.2995zm6.111 0.1555c4e-3 5e-4 0.01 2e-3 0.0155 0.0035 0.033 0.0135 0.01 0.1305-0.114 0.5555-0.0235 0.128-0.0805 0.229-0.164 0.313-0.0275 0-0.04-0.032-0.083-0.2095-0.0365-0.1515-0.0405-0.2865-0.015-0.4075 0.044-0.1515 0.222-0.198 0.3605-0.255zm-0.7415 0.9265c0.0105-2e-3 0.0205 0.0035 0.0335 0.014 0.045 0.0315 0.0515 0.1145 0.0215 0.277-0.0365 0.209-0.0445 0.232-0.0985 0.2535-0.0235 0.0105-0.0655 0.018-0.0935 0.018-0.0505-9e-3 -0.0635-0.05-0.0515-0.112 0-0.13 0.038-0.243 0.124-0.3765 0.0325-0.05 0.049-0.0715 0.0645-0.074zm-4.3165 0.0095c0.0345 0 0.1385 0.075 0.177 0.127 0.043 0.055 0.092 0.3825 0.0645 0.439-0.0315 0.071-0.1855 0.0355-0.228-0.053-0.026-0.053-0.0875-0.339-0.0875-0.407 0-0.063 0.0305-0.106 0.074-0.106zm3.9455 0.0865c0.042 0.06 0.053 0.137 0.044 0.306l-0.0085 0.154-0.044 0.044c-0.0265 0.0245-0.0715 0.0545-0.0985 0.067-0.0595 0.028-0.105 0.0305-0.1135 8e-3 -0.01-0.03 7e-3 -0.221 0.0255-0.2855 0.0215-0.0665 0.118-0.265 0.15-0.307 0.0145-0.0385 0.0315 0.0095 0.045 0.0135zm-2.5105-9e-3c0.0905 0.023 0.1305 0.1045 0.18 0.1785l0.0335 0.066-0.047 0.1635c-0.025 0.09-0.0515 0.171-0.0595 0.18-9e-3 0.01-0.0425 0.015-0.092 0.0145-0.132-0.0035-0.147-9e-3 -0.1825-0.063l-0.033-0.049 0.028-0.1375c0.0405-0.198 0.06-0.2575 0.105-0.3085 0.0235-0.0275 0.047-0.0425 0.0675-0.0445zm-0.8355 0.1415 0.0745 0.0745 0.0125 0.1685c0.0065 0.092 0.0095 0.1775 0.0045 0.188-0.0045 0.0145-0.0315 0.0185-0.115 0.0185h-0.1085c-0.058-0.0635-0.076-0.141-0.1005-0.221-0.057-0.2405-0.057-0.35 2e-3 -0.3645 0.0965 6e-3 0.16 0.076 0.2305 0.136zm2.9-0.1155c0.118 0.0315 0.0945 0.219 0.094 0.353-9e-3 0.217-0.0175 0.262-0.0455 0.29-0.0485 0.0485-0.1835 0.0215-0.249-0.0505-0.0215-0.026-0.0235-0.034-0.0065-0.1395 0.0195-0.1285 0.0445-0.2085 0.1-0.3185 0.0405-0.079 0.0785-0.1285 0.107-0.1345zm-2.663 0.01c0.0065-5e-4 0.017 0 0.027 1e-3 0.075 6e-3 0.145 0.055 0.207 0.145l0.05 0.0735c0.0045 0.1205 0 0.2475-0.0215 0.3595-0.013 0.0065-0.067 0.0165-0.12 0.0215-0.092 0.0085-0.1005 0.0065-0.1325-0.0215-0.0445-0.038-0.057-0.1085-0.068-0.3425-0.0065-0.191-2e-3 -0.2335 0.058-0.2365zm1.1345 0.04c0.0805 0.017 0.1315 0.06 0.154 0.1305 0.018 0.0605 0.029 0.399 0.0115 0.4225-6e-3 0.01-0.044 0.0225-0.0875 0.028-0.162 0.0205-0.305 5e-3 -0.319-0.0335-0.018-0.044 0.1025-0.48 0.147-0.534 0.019-0.042 0.065-0.0095 0.094-0.0135zm1.049 3e-3c0.0355-0.0035 0.0735 0.0305 0.1105 0.103 0.03 0.0605 0.0345 0.0815 0.0345 0.217 0 0.108-0.0065 0.1545-0.018 0.1645-0.01 8e-3 -0.0505 0.0225-0.0935 0.0335-0.075 0.0195-0.0915 0.0215-0.115 0.0135l-0.1125-0.0205 0.0085-0.067c8e-3 -0.0875 0.0655-0.2815 0.106-0.3655 0.024-0.05 0.0515-0.075 0.0795-0.0785zm-0.489 0.0015c0.0235-1e-3 0.0345 0.0045 0.0495 0.021 0.0355 0.042 0.0805 0.166 0.109 0.2985 0.038 0.1865 0.038 0.186-0.0435 0.2105-0.0355 0.011-0.1105 0.0225-0.164 0.0255-0.1765 9e-3 -0.19-0.0015-0.1685-0.1575 0.017-0.139 0.0855-0.358 0.115-0.374 0.032-0.017 0.069-0.0165 0.1025-0.024zm-8.9965 0.7045c0.0015-5e-4 0.0035 0 0.0035 0 0.0045 0.0975 0.0045 0.196 0.0065 0.294-0.2475-0.019-0.4295-0.078-0.4295-0.1475 0-0.0685 0.1755-0.127 0.4195-0.1465zm0.4325 0.0085c0.2005 0.025 0.339 0.0775 0.3365 0.138 0 0.061-0.134 0.113-0.333 0.1375-2e-3 -0.0915-2e-3 -0.1835-0.0035-0.2755zm9.363 0.2665c0.017-0.0015 0.0245-3e-3 0.0505-5e-4 0.104 0.0105 0.119 0.017 0.119 0.052 0 0.046-0.079 0.1845-0.1325 0.2325-0.025 0.024-0.0595 0.044-0.0715 0.044-0.06 0-0.095-0.1265-0.067-0.243 0.017-0.063 0.048-0.0825 0.1015-0.085zm-0.3775 0.0415c0.0465-4e-3 0.0915 0.0085 0.1365 0.0145-0.013 0.1315-0.072 0.239-0.1815 0.3105-0.027 0-0.0405-0.0515-0.0405-0.164 0-0.134 7e-3 -0.1595 0.0855-0.161zm-0.414 0.0485c0.0965 0 0.1815 0.0045 0.1855 0.01 0.018 0.017-0.034 0.146-0.1105 0.277-0.0655 0.1165-0.075 0.125-0.1155 0.128-0.159-0.018-0.1545-0.2045-0.179-0.3325 0-0.076 0.017-0.0825 0.2195-0.0825zm-1.5045 0.0145c0.1105 2e-3 0.1535 0.0185 0.1535 0.061 0 0.054-0.041 0.1615-0.0645 0.175-0.0355 0.0195-0.0385 0.0185-0.1085-0.0545-0.1105-0.124-0.123-0.147 0.0195-0.1815zm0.532 0.0055c2e-3 3e-3 0.0235 0.042 0.045 0.086 0.047 0.0915 0.0505 0.1315 0.017 0.162-0.079 0.045-0.0955 0.0195-0.167-0.026-0.083-0.0785-0.1485-0.184-0.127-0.206 0.074-0.0265 0.1555-0.0165 0.232-0.016zm0.211 0.0025 0.1975 0.0035c0.077 0 0.1435 4e-3 0.147 0.01 0.0135 0.012-0.03 0.269-0.0535 0.327-0.027 0.065-0.1215 0.0655-0.1705-0.0115-0.07-0.1105-0.116-0.2035-0.1175-0.2675z' - export const FreeSewingIcon = (props) => ( - + ) export const GithubIcon = (props) => ( - + ) @@ -169,14 +179,14 @@ export const HomeIcon = (props) => ( ) -export const LeftIcon = (props) => ( +export const I18nIcon = (props) => ( ) export const InstagramIcon = (props) => ( - + ) @@ -249,7 +259,7 @@ export const PrintIcon = (props) => ( ) export const RedditIcon = (props) => ( - + ) @@ -279,6 +289,13 @@ export const SettingsIcon = (props) => ( ) +export const ShowcaseIcon = (props) => ( + + + + +) + export const ThemeIcon = (props) => ( @@ -300,7 +317,7 @@ export const TutorialIcon = (props) => ( ) export const TwitterIcon = (props) => ( - + ) diff --git a/sites/shared/components/json-highlight.js b/sites/shared/components/json-highlight.js deleted file mode 100644 index 99800350ac9..00000000000 --- a/sites/shared/components/json-highlight.js +++ /dev/null @@ -1,17 +0,0 @@ -import React from 'react' -import Highlight from 'shared/components/mdx/highlight.js' -import hljs from 'highlight.js/lib/common' - -const Json = props => { - const code = props.js - ? JSON.stringify(props.js, null, 2) - : props.children - - return -} - -export default Json - diff --git a/sites/shared/components/json.mjs b/sites/shared/components/json.mjs new file mode 100644 index 00000000000..79856896ec6 --- /dev/null +++ b/sites/shared/components/json.mjs @@ -0,0 +1,9 @@ +import React from 'react' +import Highlight from 'shared/components/mdx/highlight.mjs' +import hljs from 'highlight.js/lib/common' + +export const Json = (props) => { + const code = props.js ? JSON.stringify(props.js, null, 2) : props.children + + return +} diff --git a/sites/shared/components/lightbox.js b/sites/shared/components/lightbox.js deleted file mode 100644 index dab7fd8c1ab..00000000000 --- a/sites/shared/components/lightbox.js +++ /dev/null @@ -1,30 +0,0 @@ -import { useState } from 'react' - -const Lightbox = ({ cancel, children }) => { - - const [ box, setBox ] = useState(false) - - if (box) return ( -
setBox(false)}> -
- {children} -
-
- ) - - return ( -
setBox(!box)} - className="hover:cursor-zoom-in" - >{children}
- ) -} - -export default Lightbox diff --git a/sites/shared/components/lightbox.mjs b/sites/shared/components/lightbox.mjs new file mode 100644 index 00000000000..4008de16694 --- /dev/null +++ b/sites/shared/components/lightbox.mjs @@ -0,0 +1,33 @@ +import { useState } from 'react' + +export const Lightbox = ({ cancel, children }) => { + const [box, setBox] = useState(false) + + if (box) + return ( +
setBox(false)} + > +
+ {children} +
+
+ ) + + return ( +
setBox(!box)} className="hover:cursor-zoom-in"> + {children} +
+ ) +} diff --git a/sites/shared/components/loader.js b/sites/shared/components/loader.mjs similarity index 81% rename from sites/shared/components/loader.js rename to sites/shared/components/loader.mjs index 14a8a97cca1..7678f9aa372 100644 --- a/sites/shared/components/loader.js +++ b/sites/shared/components/loader.mjs @@ -1,6 +1,6 @@ -import Spinner from 'shared/components/spinner.js' +import { Spinner } from 'shared/components/spinner.mjs' -const Loader = () => ( +export const Loader = () => (
(

) - -export default Loader diff --git a/sites/shared/components/locale-picker/index.js b/sites/shared/components/locale-picker/index.mjs similarity index 91% rename from sites/shared/components/locale-picker/index.js rename to sites/shared/components/locale-picker/index.mjs index 75434295cd6..b431e6c9ee0 100644 --- a/sites/shared/components/locale-picker/index.js +++ b/sites/shared/components/locale-picker/index.mjs @@ -1,13 +1,15 @@ +// Dependencies import { Fragment } from 'react' -import { LocaleIcon, DownIcon } from 'shared/components/icons.mjs' import { useRouter } from 'next/router' import { useTranslation } from 'next-i18next' import { Popover, Transition } from '@headlessui/react' import Link from 'next/link' +// Components +import { I18nIcon, DownIcon } from 'shared/components/icons.mjs' export const ns = ['locales'] -const LocalePicker = ({ iconOnly = false, bottom = false }) => { +export const LocalePicker = ({ iconOnly = false, bottom = false }) => { const { t } = useTranslation(ns) const router = useRouter() @@ -18,7 +20,7 @@ const LocalePicker = ({ iconOnly = false, bottom = false }) => { - + {!iconOnly && {t(router.locale)}} @@ -61,5 +63,3 @@ const LocalePicker = ({ iconOnly = false, bottom = false }) => { ) } - -export default LocalePicker diff --git a/sites/shared/components/logos/cc-by.js b/sites/shared/components/logos/cc-by.js deleted file mode 100644 index d6e75e61a56..00000000000 --- a/sites/shared/components/logos/cc-by.js +++ /dev/null @@ -1,7 +0,0 @@ -const CcByLogo = ({ color='currentColor', className="w-6 h-6" }) => ( - - - -) - -export default CcByLogo diff --git a/sites/shared/components/logos/cc-by.mjs b/sites/shared/components/logos/cc-by.mjs new file mode 100644 index 00000000000..0adc678d1a1 --- /dev/null +++ b/sites/shared/components/logos/cc-by.mjs @@ -0,0 +1,9 @@ +export const CCByLogo = ({ color = 'currentColor', className = 'w-6 h-6' }) => ( + + + +) diff --git a/sites/shared/components/logos/cc.js b/sites/shared/components/logos/cc.js deleted file mode 100644 index edfdc3dbd18..00000000000 --- a/sites/shared/components/logos/cc.js +++ /dev/null @@ -1,7 +0,0 @@ -const CreativeCommonsLogo = ({ color='currentColor', className="w-40" }) => ( - - - -) - -export default CreativeCommonsLogo diff --git a/sites/shared/components/logos/cc.mjs b/sites/shared/components/logos/cc.mjs new file mode 100644 index 00000000000..03e45c3b335 --- /dev/null +++ b/sites/shared/components/logos/cc.mjs @@ -0,0 +1,8 @@ +export const CCLogo = ({ color = 'currentColor', className = 'w-40' }) => ( + + + +) diff --git a/sites/shared/components/logos/freesewing.js b/sites/shared/components/logos/freesewing.js deleted file mode 100644 index 04cfba1d590..00000000000 --- a/sites/shared/components/logos/freesewing.js +++ /dev/null @@ -1,36 +0,0 @@ -import React from 'react' -import { logoPath } from 'shared/components/icons/freesewing.js' -import colors from 'tailwindcss/colors' - -const strokes = { - light: colors.neutral[300], - dark: colors.neutral[800], - hax0r: colors.lime[700], - lgbtq: colors.neutral[500], - trans: colors.neutral[500], -} -let step = 0 - -const Logo = ({ className = 'w-20 h-20', theme = 'light', stroke = false }) => { - const svgProps = { - xmlns: 'http://www.w3.org/2000/svg', - viewBox: '1 0 25 25', - className: className, - } - return ( - - - - - - - - ) -} - -export default Logo diff --git a/sites/shared/components/logos/freesewing.mjs b/sites/shared/components/logos/freesewing.mjs new file mode 100644 index 00000000000..a933ec9c26f --- /dev/null +++ b/sites/shared/components/logos/freesewing.mjs @@ -0,0 +1,36 @@ +import React from 'react' +import colors from 'tailwindcss/colors' + +const strokes = { + light: colors.neutral[300], + dark: colors.neutral[800], + hax0r: colors.lime[700], + lgbtq: colors.neutral[500], + trans: colors.neutral[500], +} +let step = 0 + +export const logoPath = + 'm18.56 0c-0.4945 0.3515-0.469 0.3065-0.8685 0.437-0.916 0.2995-1.7945 0.135-2.837 0.048-0.3135-0.035-0.6245-0.0555-0.928-0.0575-1.5325-0.0105-2.834 0.439-3.0805 1.694-0.4545 0.2755-0.8725 0.609-1.2865 0.943-0.884 0.6975-1.5495 1.55-2.0035 2.5775-0.62 1.5175-0.06 3.146 0.2175 4.684 0.066 0.36 0.135 0.703 0.172 0.8355 0.0525 0.1865 0.145 0.3645 0.2455 0.5245 0.0235 4e-3 0.1475-0.187 0.177-0.2715 0.043-0.123 0.0385-0.3205-0.0085-0.4905-0.104-0.3825-0.203-0.693-0.2115-0.849-0.015-0.293 0.042-0.5635 0.149-0.6975 0.038-0.0475 0.125 0.1975 0.1025 0.2885-0.0265 0.1095-0.0465 0.297-0.038 0.3835 0.0235 0.293 0.0665 0.6065 0.12 0.8805 0.0685 0.3535 0.098 0.5805 0.0855 0.6685-9e-3 0.064-0.039 0.1285-0.154 0.3265-0.1 0.1735-0.152 0.314-0.16 0.438-0.0085 0.121 0.028 0.4235 0.062 0.4975 0.0495 0.1155 0.1985 0.237 0.3285 0.267 0.1245 0.0475 0.187 0.146 0.251 0.2565 0.1555 0.2965 0.2755 0.6575 0.3945 1.2015 0.058 0.2605 0.1065 0.493 0.122 0.615-0.96 1e-3 -2.1895 0.0015-3.3095 0.0015-0.377 6e-3 -1.058-0.171-1.6825-0.212-0.0905-0.977-0.5195-2.112-1.2535-2.178-0.501-0.0455-0.9165 0.145-1.268 0.9365l0.01 0.0425c0.2075-0.1735 0.4265-0.704 1.2155-0.6675 0.606 0.0275 0.808 1.1745 0.868 1.8645-0.369 0.027-0.683 0.1405-0.847 0.424h-0.0035c0 5e-4 0 0.0015 0.0015 0.0025-0.0015 1e-3 -0.0015 2e-3 -0.0015 3e-3h0.0035c0.169 0.2905 0.4945 0.403 0.877 0.4255 0.2555 7.225 7.047 8.157 8.903 8.157 6.924 0 9.348-4.705 9.7125-6.5685 0.1705 0.794-0.3665 1.8055-0.495 2.552 1.4605-1.6885 1.1965-3.312 0.9295-4.945 0.222 0.264 0.5225 0.4275 0.93 0.337-0.2905-0.194-0.6845-0.058-0.9205-0.8765-0.103-0.3535-0.192-0.6185-0.2805-0.841-0.191-0.7165-0.462-1.401-0.795-2.068-0.281-0.7235-0.0955-1.1925-0.1235-1.8135 0.5055 1.667 0.8215 2.1105 1.4115 2.285-1.484-1.788-0.976-4.5565-1.8145-7.0275 0.3795 0.223 0.8125 0.29 1.2735 0.0175-0.446-0.127-0.891 0.2085-1.531-0.732-0.5405-1.0515-1.3235-1.828-2.2735-2.513-0.509-0.332-1.074-0.555-1.642-0.762 0.5785-0.145 1.2245-0.66 1.2545-1.0445zm-0.9705 5.5535c0.762 0.278 1.602 1.334 1.5925 2.37v0.058c-0.0205 1.407-0.66 2.1635-0.633 3.1005 0.0345 1.1035 0.5095 1.4885 0.604 1.6725-0.162-0.6805-0.257-1.5365-0.043-2.2145 0.275-0.872 0.5525-1.594 0.5325-2.277-0.01-0.16-0.078-0.7585-0.1235-1.0235 0.817 1.179-0.177 2.8935 0.109 4.0155 0.497 1.9545 2.7245 2.2015 2.0615 6.1395-0.5835 3.462-4.5815 6.0895-8.6795 6.0895-3.038 0-8.3025-1.6815-8.5625-7.646 0.6175-0.044 1.2815-0.216 1.654-0.21 1.126 0 2.412 5e-4 3.381 1e-3 0.182 0.821 0.3185 1.019 1.009 1.566 0.768 0.604 0.947 0.6775 2.083 0.6885 1.1365 0.0115 1.4735-0.232 2.576-1.275 0.238-0.279 0.341-0.6445 0.4565-0.988 1.134-0.0105 1.961-0.0305 2.7745-0.0685 0.8285-0.0375 0.9455 0 2.2805-0.1375-1.335-0.1375-1.452-0.1-2.2805-0.138-0.792-0.036-1.594-0.0565-2.6785-0.0665 0.091-0.4085 0.221-0.8075 0.3595-1.202 0.0855-0.2325 0.186-0.459 0.289-0.6845l0.1125-0.035c0.217-0.077 0.409-0.242 0.4855-0.465 0.0985-0.2955 0.0285-0.6275-0.162-0.869-0.0655-0.0905-0.147-0.206-0.1805-0.257-0.1005-0.159-0.103-0.2475-0.018-0.8385 0.0715-0.495 0.0795-0.754 0.03-1.005-0.01-0.1435-0.011-0.4385-0.0155-0.518 0.038 0.021 0.1205 0.209 0.204 0.4635 0.083 0.2555 0.0965 0.3085 0.1155 0.526 0.021 0.247-0.0715 0.43-0.1475 0.7985-0.038 0.19-0.0715 0.3665-0.0715 0.3905 0 0.0255 0.018 0.0795 0.037 0.1215 0.0445 0.094 0.128 0.226 0.1435 0.226 0.2725-0.3005 0.4325-0.6715 0.575-1.048 0.15-0.426 0.194-0.878 0.299-1.3165 0.085-0.382 0.183-0.7645 0.2135-1.1565 0.0615-0.765 0.0255-1.305-0.1435-2.102-0.0405-0.18-0.1575-0.5235-0.239-0.6855zm-2.68 3.7685c0.2925-0.0035 0.582 0.032 0.8575 0.1115 0.3745 0.1435 0.427 0.478 0.496 0.8535 0.0385 0.24 0.037 0.4125-0.0065 0.6945-0.0305 0.409-0.193 0.7255-0.548 0.948-0.5355 0.099-1.108 0.1945-1.562-0.16-0.381-0.525-0.6105-1.1885-0.523-1.8355 0.0555-0.2655 0.179-0.4035 0.433-0.486 0.2735-0.0785 0.563-0.1215 0.853-0.126zm-4.4415 0.0475c0.2735-0.0025 0.55 0.0265 0.702 0.1235 0.6525 0.4415 0.443 1.16 0.185 1.7905-0.3755 0.8255-1.1875 0.795-1.9745 0.7885-0.4355-0.1275-0.4755-0.4845-0.5385-0.866-0.054-0.3685-0.169-0.7635-0.073-1.134 0.2465-0.596 1.1475-0.6645 1.699-0.7025zm9.9515 0.103c0.0035 1.5865 0.2745 2.366 0.8185 3.4895-0.3205-0.6115-0.7785-0.9595-0.949-1.6905-0.326-1.4115 0.0255-1.3325 0.1305-1.799zm-7.9065 1.149c0.086 0.087 0.1275 0.207 0.202 0.3025 0.0575-0.0985 0.1165-0.1965 0.1905-0.284 0.0385 1e-3 0.0855 0.077 0.128 0.213 0.182 0.503 0.2175 1.0565 0.4535 1.54 0.2205 0.35-0.0805 0.554-0.411 0.57-0.241-5e-4 -0.343-0.165-0.4845-0.328-0.0365 0.1065-0.106 0.175-0.189 0.247-0.211 0.177-0.6245 0.1115-0.6885-0.1675 0.085-0.533 0.3565-1.0225 0.5345-1.5335 0.0885-0.1865 0.0895-0.3295 0.2645-0.5595zm-3.096 2.6925c0.1065 0 0.399 0.1985 0.4585 0.3105 0.041 0.0745 0.1345 0.3645 0.141 0.435 0.0105 0.084-0.015 0.283-0.041 0.337-0.019 0.0385-0.0335 0.044-0.0555 0.019-0.0185-0.021-0.2635-0.491-0.42-0.802-0.123-0.249-0.136-0.2995-0.083-0.2995zm6.111 0.1555c4e-3 5e-4 0.01 2e-3 0.0155 0.0035 0.033 0.0135 0.01 0.1305-0.114 0.5555-0.0235 0.128-0.0805 0.229-0.164 0.313-0.0275 0-0.04-0.032-0.083-0.2095-0.0365-0.1515-0.0405-0.2865-0.015-0.4075 0.044-0.1515 0.222-0.198 0.3605-0.255zm-0.7415 0.9265c0.0105-2e-3 0.0205 0.0035 0.0335 0.014 0.045 0.0315 0.0515 0.1145 0.0215 0.277-0.0365 0.209-0.0445 0.232-0.0985 0.2535-0.0235 0.0105-0.0655 0.018-0.0935 0.018-0.0505-9e-3 -0.0635-0.05-0.0515-0.112 0-0.13 0.038-0.243 0.124-0.3765 0.0325-0.05 0.049-0.0715 0.0645-0.074zm-4.3165 0.0095c0.0345 0 0.1385 0.075 0.177 0.127 0.043 0.055 0.092 0.3825 0.0645 0.439-0.0315 0.071-0.1855 0.0355-0.228-0.053-0.026-0.053-0.0875-0.339-0.0875-0.407 0-0.063 0.0305-0.106 0.074-0.106zm3.9455 0.0865c0.042 0.06 0.053 0.137 0.044 0.306l-0.0085 0.154-0.044 0.044c-0.0265 0.0245-0.0715 0.0545-0.0985 0.067-0.0595 0.028-0.105 0.0305-0.1135 8e-3 -0.01-0.03 7e-3 -0.221 0.0255-0.2855 0.0215-0.0665 0.118-0.265 0.15-0.307 0.0145-0.0385 0.0315 0.0095 0.045 0.0135zm-2.5105-9e-3c0.0905 0.023 0.1305 0.1045 0.18 0.1785l0.0335 0.066-0.047 0.1635c-0.025 0.09-0.0515 0.171-0.0595 0.18-9e-3 0.01-0.0425 0.015-0.092 0.0145-0.132-0.0035-0.147-9e-3 -0.1825-0.063l-0.033-0.049 0.028-0.1375c0.0405-0.198 0.06-0.2575 0.105-0.3085 0.0235-0.0275 0.047-0.0425 0.0675-0.0445zm-0.8355 0.1415 0.0745 0.0745 0.0125 0.1685c0.0065 0.092 0.0095 0.1775 0.0045 0.188-0.0045 0.0145-0.0315 0.0185-0.115 0.0185h-0.1085c-0.058-0.0635-0.076-0.141-0.1005-0.221-0.057-0.2405-0.057-0.35 2e-3 -0.3645 0.0965 6e-3 0.16 0.076 0.2305 0.136zm2.9-0.1155c0.118 0.0315 0.0945 0.219 0.094 0.353-9e-3 0.217-0.0175 0.262-0.0455 0.29-0.0485 0.0485-0.1835 0.0215-0.249-0.0505-0.0215-0.026-0.0235-0.034-0.0065-0.1395 0.0195-0.1285 0.0445-0.2085 0.1-0.3185 0.0405-0.079 0.0785-0.1285 0.107-0.1345zm-2.663 0.01c0.0065-5e-4 0.017 0 0.027 1e-3 0.075 6e-3 0.145 0.055 0.207 0.145l0.05 0.0735c0.0045 0.1205 0 0.2475-0.0215 0.3595-0.013 0.0065-0.067 0.0165-0.12 0.0215-0.092 0.0085-0.1005 0.0065-0.1325-0.0215-0.0445-0.038-0.057-0.1085-0.068-0.3425-0.0065-0.191-2e-3 -0.2335 0.058-0.2365zm1.1345 0.04c0.0805 0.017 0.1315 0.06 0.154 0.1305 0.018 0.0605 0.029 0.399 0.0115 0.4225-6e-3 0.01-0.044 0.0225-0.0875 0.028-0.162 0.0205-0.305 5e-3 -0.319-0.0335-0.018-0.044 0.1025-0.48 0.147-0.534 0.019-0.042 0.065-0.0095 0.094-0.0135zm1.049 3e-3c0.0355-0.0035 0.0735 0.0305 0.1105 0.103 0.03 0.0605 0.0345 0.0815 0.0345 0.217 0 0.108-0.0065 0.1545-0.018 0.1645-0.01 8e-3 -0.0505 0.0225-0.0935 0.0335-0.075 0.0195-0.0915 0.0215-0.115 0.0135l-0.1125-0.0205 0.0085-0.067c8e-3 -0.0875 0.0655-0.2815 0.106-0.3655 0.024-0.05 0.0515-0.075 0.0795-0.0785zm-0.489 0.0015c0.0235-1e-3 0.0345 0.0045 0.0495 0.021 0.0355 0.042 0.0805 0.166 0.109 0.2985 0.038 0.1865 0.038 0.186-0.0435 0.2105-0.0355 0.011-0.1105 0.0225-0.164 0.0255-0.1765 9e-3 -0.19-0.0015-0.1685-0.1575 0.017-0.139 0.0855-0.358 0.115-0.374 0.032-0.017 0.069-0.0165 0.1025-0.024zm-8.9965 0.7045c0.0015-5e-4 0.0035 0 0.0035 0 0.0045 0.0975 0.0045 0.196 0.0065 0.294-0.2475-0.019-0.4295-0.078-0.4295-0.1475 0-0.0685 0.1755-0.127 0.4195-0.1465zm0.4325 0.0085c0.2005 0.025 0.339 0.0775 0.3365 0.138 0 0.061-0.134 0.113-0.333 0.1375-2e-3 -0.0915-2e-3 -0.1835-0.0035-0.2755zm9.363 0.2665c0.017-0.0015 0.0245-3e-3 0.0505-5e-4 0.104 0.0105 0.119 0.017 0.119 0.052 0 0.046-0.079 0.1845-0.1325 0.2325-0.025 0.024-0.0595 0.044-0.0715 0.044-0.06 0-0.095-0.1265-0.067-0.243 0.017-0.063 0.048-0.0825 0.1015-0.085zm-0.3775 0.0415c0.0465-4e-3 0.0915 0.0085 0.1365 0.0145-0.013 0.1315-0.072 0.239-0.1815 0.3105-0.027 0-0.0405-0.0515-0.0405-0.164 0-0.134 7e-3 -0.1595 0.0855-0.161zm-0.414 0.0485c0.0965 0 0.1815 0.0045 0.1855 0.01 0.018 0.017-0.034 0.146-0.1105 0.277-0.0655 0.1165-0.075 0.125-0.1155 0.128-0.159-0.018-0.1545-0.2045-0.179-0.3325 0-0.076 0.017-0.0825 0.2195-0.0825zm-1.5045 0.0145c0.1105 2e-3 0.1535 0.0185 0.1535 0.061 0 0.054-0.041 0.1615-0.0645 0.175-0.0355 0.0195-0.0385 0.0185-0.1085-0.0545-0.1105-0.124-0.123-0.147 0.0195-0.1815zm0.532 0.0055c2e-3 3e-3 0.0235 0.042 0.045 0.086 0.047 0.0915 0.0505 0.1315 0.017 0.162-0.079 0.045-0.0955 0.0195-0.167-0.026-0.083-0.0785-0.1485-0.184-0.127-0.206 0.074-0.0265 0.1555-0.0165 0.232-0.016zm0.211 0.0025 0.1975 0.0035c0.077 0 0.1435 4e-3 0.147 0.01 0.0135 0.012-0.03 0.269-0.0535 0.327-0.027 0.065-0.1215 0.0655-0.1705-0.0115-0.07-0.1105-0.116-0.2035-0.1175-0.2675z' + +export const FreeSewingLogo = ({ className = 'w-20 h-20', theme = 'light', stroke = false }) => { + const svgProps = { + xmlns: 'http://www.w3.org/2000/svg', + viewBox: '1 0 25 25', + className: className, + } + return ( + + + + + + + + ) +} diff --git a/sites/shared/components/logos/osi.js b/sites/shared/components/logos/osi.js deleted file mode 100644 index f1bfa425556..00000000000 --- a/sites/shared/components/logos/osi.js +++ /dev/null @@ -1,7 +0,0 @@ -const OsiLogo = ({ color='currentColor', className="w-6 h-6" }) => ( - - - -) - -export default OsiLogo diff --git a/sites/shared/components/logos/osi.mjs b/sites/shared/components/logos/osi.mjs new file mode 100644 index 00000000000..a45a6027db5 --- /dev/null +++ b/sites/shared/components/logos/osi.mjs @@ -0,0 +1,10 @@ +export const OsiLogo = ({ color = 'currentColor', className = 'w-6 h-6' }) => ( + + + +) diff --git a/sites/shared/components/mdx/examples.js b/sites/shared/components/mdx/examples.mjs similarity index 91% rename from sites/shared/components/mdx/examples.js rename to sites/shared/components/mdx/examples.mjs index e18caa1dac0..03da5222c58 100644 --- a/sites/shared/components/mdx/examples.js +++ b/sites/shared/components/mdx/examples.mjs @@ -1,5 +1,5 @@ import { Tutorial } from '@freesewing/tutorial' -import { Examples } from '@freesewing/examples' +import { Examples as Pattern } from '@freesewing/examples' import Svg from '../workbench/draft/svg' import Defs from '../workbench/draft/defs' import Stack from '../workbench/draft/stack' @@ -11,7 +11,7 @@ import Md from 'react-markdown' // head: 320, // }, //} -const ExamplesComponent = ({ app, part, caption, xray }) => { +export const Examples = ({ app, part, caption, xray }) => { // State for gist const { gist, unsetGist, updateGist } = useGist('examples-mdx', app) @@ -21,7 +21,7 @@ const ExamplesComponent = ({ app, part, caption, xray }) => { } //const measurements = part.includes('tutorial') ? measurementSets.tutorial : {} - const pattern = Examples + const pattern = Pattern const draft = new pattern({ only: [`examples.${part}`], measurements: {}, @@ -61,5 +61,3 @@ const ExamplesComponent = ({ app, part, caption, xray }) => {
) } - -export default ExamplesComponent diff --git a/sites/shared/components/mdx/figure.js b/sites/shared/components/mdx/figure.js deleted file mode 100644 index 425af8dc4f3..00000000000 --- a/sites/shared/components/mdx/figure.js +++ /dev/null @@ -1,38 +0,0 @@ -import Popout from 'shared/components/popout' -import Lightbox from 'shared/components/lightbox' -import ImageWrapper from 'shared/components/wrappers/img.js' - -const Figure = props => { - - const title = props?.title - ? props.title - : props?.alt - ? props.alt - : false - - return ( -
- - - {props?.alt - - {title - ?
{title}
- : ( - -
This image does not have an alt of title specified
-

Please improve our documentation and fix this.

-
- ) - } -
-
- ) -} - -export default Figure diff --git a/sites/shared/components/mdx/figure.mjs b/sites/shared/components/mdx/figure.mjs new file mode 100644 index 00000000000..8b02a1c91af --- /dev/null +++ b/sites/shared/components/mdx/figure.mjs @@ -0,0 +1,25 @@ +import { Popout } from 'shared/components/popout.mjs' +import { Lightbox } from 'shared/components/lightbox.mjs' +import { ImageWrapper } from 'shared/components/wrappers/img.mjs' + +export const Figure = (props) => { + const title = props?.title ? props.title : props?.alt ? props.alt : false + + return ( +
+ + + {props?.alt + + {title ? ( +
{title}
+ ) : ( + +
This image does not have an alt of title specified
+

Please improve our documentation and fix this.

+
+ )} +
+
+ ) +} diff --git a/sites/shared/components/mdx/highlight.js b/sites/shared/components/mdx/highlight.mjs similarity index 79% rename from sites/shared/components/mdx/highlight.js rename to sites/shared/components/mdx/highlight.mjs index 5e9229d83cd..ce87371655d 100644 --- a/sites/shared/components/mdx/highlight.js +++ b/sites/shared/components/mdx/highlight.mjs @@ -1,5 +1,5 @@ -import CopyToClipboard from 'shared/components/copy-to-clipboard' -import StatusCode from './status-code.js' +import { CopyToClipboard } from 'shared/components/copy-to-clipboard.mjs' +import { HttpStatusCode } from './http.mjs' const names = { js: 'Javascript', @@ -9,7 +9,7 @@ const names = { yaml: 'file.yaml', } -const Highlight = (props) => { +export const Highlight = (props) => { let language = 'txt' let status = false if (props.language) language = props.language @@ -36,11 +36,9 @@ const Highlight = (props) => { `} > {names[language] ? names[language] : language} - {status ? : } + {status ? : }
{props.children}
) } - -export default Highlight diff --git a/sites/shared/components/mdx/http-method.js b/sites/shared/components/mdx/http.mjs similarity index 53% rename from sites/shared/components/mdx/http-method.js rename to sites/shared/components/mdx/http.mjs index 1a32ba12af8..c12746801fa 100644 --- a/sites/shared/components/mdx/http-method.js +++ b/sites/shared/components/mdx/http.mjs @@ -5,7 +5,7 @@ const methodClasses = { delete: 'bg-red-600 text-white', } -const Method = (props) => { +export const HttpMethod = (props) => { let method = false for (const m in methodClasses) { if (!method && props[m]) method = m.toUpperCase() @@ -22,4 +22,20 @@ const Method = (props) => { ) } -export default Method +const statusClasses = { + 2: 'bg-green-600 text-white', + 4: 'bg-orange-500 text-white', + 5: 'bg-red-600 text-white', +} + +export const HttpStatusCode = ({ status }) => { + return ( +
+ {status} +
+ ) +} diff --git a/sites/shared/components/mdx/index.js b/sites/shared/components/mdx/index.mjs similarity index 59% rename from sites/shared/components/mdx/index.js rename to sites/shared/components/mdx/index.mjs index 0ffb503e0bc..e65b8c08e70 100644 --- a/sites/shared/components/mdx/index.js +++ b/sites/shared/components/mdx/index.mjs @@ -1,20 +1,19 @@ -import Popout from '../popout.js' -import Highlight from './highlight.js' -import YouTube from './youtube.js' -import Figure from './figure.js' -import ReadMore from './read-more.js' -import { Tab, Tabs } from './tabs.js' -import Example from './example.js' -import Examples from './examples.js' -import Method from './http-method.js' -import StatusCode from './status-code.js' +import { Popout } from 'shared/components/popout.mjs' +import { Highlight } from './highlight.mjs' +import { YouTube } from './youtube.mjs' +import { Figure } from './figure.mjs' +import { ReadMore } from './read-more.mjs' +import { Tab, Tabs } from './tabs.mjs' +import { TabbedExample as Example } from './tabbed-example.mjs' +import { Examples } from './examples.mjs' +import { HttpMethod, HttpStatusCode } from './http.mjs' const Fixme = () =>

FIXME

-const mdxCustomComponents = (app = false) => ({ +export const MdxComponents = (app = false) => ({ // Custom components - Method, - StatusCode, + Method: HttpMethod, + StatusCode: HttpStatusCode, Comment: (props) => , Fixme: (props) => , Link: (props) => , @@ -38,7 +37,3 @@ const mdxCustomComponents = (app = false) => ({ PatternDocs: Fixme, PatternOptions: Fixme, }) - -export default mdxCustomComponents - -//{children} diff --git a/sites/shared/components/mdx/prev-next.js b/sites/shared/components/mdx/prev-next.mjs similarity index 95% rename from sites/shared/components/mdx/prev-next.js rename to sites/shared/components/mdx/prev-next.mjs index 4679dea6acf..cfb5109c1ce 100644 --- a/sites/shared/components/mdx/prev-next.js +++ b/sites/shared/components/mdx/prev-next.mjs @@ -74,7 +74,7 @@ const next = (app) => { const renderPrevious = (node) => node ? (
- + {node.__linktitle} @@ -89,13 +89,13 @@ const renderNext = (node) => {node.__linktitle} - +
) : ( ) -const PrevNext = ({ app }) => { +export const PrevNext = ({ app }) => { return (
{renderPrevious(previous(app))} @@ -103,5 +103,3 @@ const PrevNext = ({ app }) => {
) } - -export default PrevNext diff --git a/sites/shared/components/mdx/read-more.js b/sites/shared/components/mdx/read-more.mjs similarity index 94% rename from sites/shared/components/mdx/read-more.js rename to sites/shared/components/mdx/read-more.mjs index 3ed7e651a14..b0c7b103876 100644 --- a/sites/shared/components/mdx/read-more.js +++ b/sites/shared/components/mdx/read-more.mjs @@ -7,7 +7,7 @@ const order = (obj) => orderBy(obj, ['__order', '__title'], ['asc', 'asc']) const currentChildren = (current) => Object.values(order(current)).filter((entry) => typeof entry === 'object') -const ReadMore = (props) => { +export const ReadMore = (props) => { // Don't bother if we don't have the navigation tree in app if (!props.app) return null @@ -28,5 +28,3 @@ const ReadMore = (props) => { } return
    {list}
} - -export default ReadMore diff --git a/sites/shared/components/mdx/status-code.js b/sites/shared/components/mdx/status-code.js deleted file mode 100644 index a0ab81835ef..00000000000 --- a/sites/shared/components/mdx/status-code.js +++ /dev/null @@ -1,19 +0,0 @@ -const statusClasses = { - 2: 'bg-green-600 text-white', - 4: 'bg-orange-500 text-white', - 5: 'bg-red-600 text-white', -} - -const StatusCode = ({ status }) => { - return ( -
- {status} -
- ) -} - -export default StatusCode diff --git a/sites/shared/components/mdx/example.js b/sites/shared/components/mdx/tabbed-example.mjs similarity index 98% rename from sites/shared/components/mdx/example.js rename to sites/shared/components/mdx/tabbed-example.mjs index 691939a0c0a..80648d9c1d5 100644 --- a/sites/shared/components/mdx/example.js +++ b/sites/shared/components/mdx/tabbed-example.mjs @@ -1,4 +1,4 @@ -import { Tab, Tabs } from './tabs.js' +import { Tab, Tabs } from './tabs.mjs' import Md from 'react-markdown' import { pluginBundle } from '@freesewing/plugin-bundle' import { pluginFlip } from '@freesewing/plugin-flip' @@ -99,7 +99,7 @@ const buildExample = (children, settings = { margin: 5 }, tutorial = false, pape } // Wrapper component dealing with the tabs and code view -const TabbedExample = ({ +export const TabbedExample = ({ app, children, caption, @@ -156,5 +156,3 @@ const TabbedExample = ({ ) } - -export default TabbedExample diff --git a/sites/shared/components/mdx/tabs.js b/sites/shared/components/mdx/tabs.mjs similarity index 92% rename from sites/shared/components/mdx/tabs.js rename to sites/shared/components/mdx/tabs.mjs index c1fb27d2230..7b30835f92e 100644 --- a/sites/shared/components/mdx/tabs.js +++ b/sites/shared/components/mdx/tabs.mjs @@ -19,7 +19,9 @@ export const Tabs = ({ tabs = '', active = 0, children }) => { {tablist.map((title, tabId) => (