Skip to content
This repository has been archived by the owner on Jul 9, 2022. It is now read-only.

Commit

Permalink
WIP - progressish
Browse files Browse the repository at this point in the history
  • Loading branch information
axe312ger committed Nov 14, 2021
1 parent 81ae844 commit 1d66850
Show file tree
Hide file tree
Showing 12 changed files with 485 additions and 64 deletions.
37 changes: 28 additions & 9 deletions examples/full/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
const merge = require('deepmerge')

const tailwindConfigStub = require('gatsby-theme-mdx-suite-core/src/tailwind.default.config')
const minimumConfig = require('gatsby-theme-mdx-suite-core/minimum-config')

const themeConfig = require('./tailwind.config.js')
const localesEn = require('./src/locales/en-US/messages')
const localesDe = require('./src/locales/de/messages')

const isProduction = process.env.NODE_ENV === 'production'

// Duplicate and rename .env.example to .env and fill in your credentials
require('dotenv').config({ path: `.env` })

const translationsEn = require('./translations/en')
const translationsDe = require('./translations/de')
function prepareMdxSuiteOptions(config) {
const mergedConfig = merge(minimumConfig, config, {
arrayMerge: (destinationArray, sourceArray, options) => sourceArray,
})

const theme = merge(tailwindConfigStub, mergedConfig.themeConfig.theme.extend)

const cleanConfig = Object.entries(mergedConfig)
.filter(([key]) => !['themeConfig', 'mediaCollections'].includes(key))
.reduce((obj, [key, val]) => Object.assign(obj, { [key]: val }), {})

// @todo clean up this mess!
return { ...cleanConfig, cleanConfig, theme }
}

module.exports = {
pathPrefix: ``,
Expand All @@ -19,7 +38,7 @@ module.exports = {
plugins: [
{
resolve: `gatsby-theme-mdx-suite-core`,
options: {
options: prepareMdxSuiteOptions({
// Configure the MDX Suite
themeConfig,
/**
Expand All @@ -31,14 +50,14 @@ module.exports = {
'en-US': '',
de: 'de',
},
// @todo
// Will be passes as resources to i18next.
// See https://www.i18next.com/overview/configuration-options
// Will be passed to LinguiJS.
// @todo can't we automatically import that in onPreInit?
translations: {
'en-US': translationsEn,
de: translationsDe,
'en-US': localesEn.messages,
de: localesDe.messages,
},
/**
* @todo this is!!! exposed via page state json. Switch to env vars!!
* Contentful credentials from environment variables will be used by default.
* Never hardcode API credentials in your projects.
* This is a exception for demonstration purposes.
Expand All @@ -48,7 +67,7 @@ module.exports = {
accessToken: `yfNcvsaJfU6nmL6xzKwbP-WHw27vvDzjTCeFkg93pKk`,
environment: `full`,
},
},
}),
},
// Basic layout, SEO, Analytics and more
{
Expand Down
11 changes: 11 additions & 0 deletions examples/full/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
const { resolve } = require('path')
const { createPath } = require('@gatsby-mdx-suite/helpers/routing')

// exports.onPreInit = async ({ store }, config) => {
// const program = store.getState().program
// const rootDir = program.directory
// console.log({
// rootDir,
// store,
// key: Object.keys(store),
// state: store.getState(),
// })
// }

exports.createPages = async ({ graphql, actions, getCache }) => {
const { createPage, createRedirect } = actions
const { config } = await getCache().get('mdx-suite')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ const NavigationMobile = ({ rootMenuItemId }) => {
<Logo />
</LogoLink>
<HeaderMenuToggle onClick={handleClickMenuToggle}>
<Icon icon="menu" title={t('menu')} />
<Icon icon="menu" title={t({ id: 'menu', message: 'Menu' })} />
</HeaderMenuToggle>
</NavigationMobileBarContent>
</NavigationMobileBar>
Expand Down
78 changes: 78 additions & 0 deletions examples/full/src/locales/de/messages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*eslint-disable*/ module.exports = {
messages: {
'consent-manager.close': 'consent-manager.close',
'consent-manager.fallback.algolia.title':
'consent-manager.fallback.algolia.title',
'consent-manager.fallback.default.description':
'consent-manager.fallback.default.description',
'consent-manager.fallback.default.enable':
'consent-manager.fallback.default.enable',
'consent-manager.fallback.default.learn-more':
'consent-manager.fallback.default.learn-more',
'consent-manager.fallback.default.title':
'consent-manager.fallback.default.title',
'consent-manager.fallback.mapbox.title':
'consent-manager.fallback.mapbox.title',
'consent-manager.fallback.vimeo.title':
'consent-manager.fallback.vimeo.title',
'consent-manager.fallback.youtube.title':
'consent-manager.fallback.youtube.title',
'consent-manager.form.description': 'consent-manager.form.description',
'consent-manager.form.disable-all': 'consent-manager.form.disable-all',
'consent-manager.form.enable-all': 'consent-manager.form.enable-all',
'consent-manager.form.headline': 'consent-manager.form.headline',
'consent-manager.form.reset': 'consent-manager.form.reset',
'consent-manager.form.save': 'consent-manager.form.save',
'consent-manager.integration.algolia.category':
'consent-manager.integration.algolia.category',
'consent-manager.integration.algolia.description':
'consent-manager.integration.algolia.description',
'consent-manager.integration.default.category':
'consent-manager.integration.default.category',
'consent-manager.integration.default.company':
'consent-manager.integration.default.company',
'consent-manager.integration.default.description':
'consent-manager.integration.default.description',
'consent-manager.integration.default.privacy-policy':
'consent-manager.integration.default.privacy-policy',
'consent-manager.integration.default.title':
'consent-manager.integration.default.title',
'consent-manager.integration.mapbox.category':
'consent-manager.integration.mapbox.category',
'consent-manager.integration.mapbox.description':
'consent-manager.integration.mapbox.description',
'consent-manager.integration.matomo.category':
'consent-manager.integration.matomo.category',
'consent-manager.integration.matomo.description':
'consent-manager.integration.matomo.description',
'consent-manager.integration.vimeo.category':
'consent-manager.integration.vimeo.category',
'consent-manager.integration.vimeo.description':
'consent-manager.integration.vimeo.description',
'consent-manager.integration.youtube.category':
'consent-manager.integration.youtube.category',
'consent-manager.integration.youtube.description':
'consent-manager.integration.youtube.description',
'consent-manager.introduction.description':
'consent-manager.introduction.description',
'consent-manager.introduction.enable-all':
'consent-manager.introduction.enable-all',
'consent-manager.introduction.learn-more':
'consent-manager.introduction.learn-more',
'consent-manager.introduction.title': 'consent-manager.introduction.title',
contactFormCompany: 'contactFormCompany',
contactFormCompanyEmail: 'contactFormCompanyEmail',
contactFormFirstName: 'contactFormFirstName',
contactFormLastName: 'contactFormLastName',
contactFormNumberOfEmployees: 'contactFormNumberOfEmployees',
contactFormPosition: 'contactFormPosition',
contactFormSubmit: 'contactFormSubmit',
contactFormTosAccepted: 'contactFormTosAccepted',
copyright: 'copyright',
menu: 'menu',
newsReadMore: 'Weiterlesen',
next: 'next',
previous: 'previous',
'{0} min. to read': [['0'], ' min. to read'],
},
}
207 changes: 207 additions & 0 deletions examples/full/src/locales/de/messages.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
msgid ""
msgstr ""
"POT-Creation-Date: 2021-11-13 12:07+0100\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: @lingui/cli\n"
"Language: de\n"
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"Plural-Forms: \n"

#: src/consent-manager-i18n.js:8
msgid "consent-manager.close"
msgstr ""

#: src/consent-manager-i18n.js:275
msgid "consent-manager.fallback.algolia.title"
msgstr ""

#: src/consent-manager-i18n.js:99
msgid "consent-manager.fallback.default.description"
msgstr ""

#: src/consent-manager-i18n.js:117
msgid "consent-manager.fallback.default.enable"
msgstr ""

#: src/consent-manager-i18n.js:124
msgid "consent-manager.fallback.default.learn-more"
msgstr ""

#: src/consent-manager-i18n.js:90
msgid "consent-manager.fallback.default.title"
msgstr ""

#: src/consent-manager-i18n.js:272
msgid "consent-manager.fallback.mapbox.title"
msgstr ""

#: src/consent-manager-i18n.js:281
msgid "consent-manager.fallback.vimeo.title"
msgstr ""

#: src/consent-manager-i18n.js:278
msgid "consent-manager.fallback.youtube.title"
msgstr ""

#: src/consent-manager-i18n.js:48
msgid "consent-manager.form.description"
msgstr ""

#: src/consent-manager-i18n.js:79
msgid "consent-manager.form.disable-all"
msgstr ""

#: src/consent-manager-i18n.js:73
msgid "consent-manager.form.enable-all"
msgstr ""

#: src/consent-manager-i18n.js:42
msgid "consent-manager.form.headline"
msgstr ""

#: src/consent-manager-i18n.js:70
msgid "consent-manager.form.reset"
msgstr ""

#: src/consent-manager-i18n.js:85
msgid "consent-manager.form.save"
msgstr ""

#: src/consent-manager-i18n.js:186
msgid "consent-manager.integration.algolia.category"
msgstr ""

#: src/consent-manager-i18n.js:176
msgid "consent-manager.integration.algolia.description"
msgstr ""

#: src/consent-manager-i18n.js:139
msgid "consent-manager.integration.default.category"
msgstr ""

#: src/consent-manager-i18n.js:132
msgid "consent-manager.integration.default.company"
msgstr ""

#: src/consent-manager-i18n.js:151
msgid "consent-manager.integration.default.description"
msgstr ""

#: src/consent-manager-i18n.js:162
msgid "consent-manager.integration.default.privacy-policy"
msgstr ""

#: src/consent-manager-i18n.js:145
msgid "consent-manager.integration.default.title"
msgstr ""

#: src/consent-manager-i18n.js:206
msgid "consent-manager.integration.mapbox.category"
msgstr ""

#: src/consent-manager-i18n.js:196
msgid "consent-manager.integration.mapbox.description"
msgstr ""

#: src/consent-manager-i18n.js:226
msgid "consent-manager.integration.matomo.category"
msgstr ""

#: src/consent-manager-i18n.js:216
msgid "consent-manager.integration.matomo.description"
msgstr ""

#: src/consent-manager-i18n.js:246
msgid "consent-manager.integration.vimeo.category"
msgstr ""

#: src/consent-manager-i18n.js:236
msgid "consent-manager.integration.vimeo.description"
msgstr ""

#: src/consent-manager-i18n.js:266
msgid "consent-manager.integration.youtube.category"
msgstr ""

#: src/consent-manager-i18n.js:256
msgid "consent-manager.integration.youtube.description"
msgstr ""

#: src/consent-manager-i18n.js:22
msgid "consent-manager.introduction.description"
msgstr ""

#: src/consent-manager-i18n.js:34
msgid "consent-manager.introduction.enable-all"
msgstr ""

#: src/consent-manager-i18n.js:28
msgid "consent-manager.introduction.learn-more"
msgstr ""

#: src/consent-manager-i18n.js:12
msgid "consent-manager.introduction.title"
msgstr ""

#: :121
msgid "contactFormCompany"
msgstr ""

#: :112
msgid "contactFormCompanyEmail"
msgstr ""

#: :95
msgid "contactFormFirstName"
msgstr ""

#: :103
msgid "contactFormLastName"
msgstr ""

#: :126
msgid "contactFormNumberOfEmployees"
msgstr ""

#: :108
msgid "contactFormPosition"
msgstr ""

#: :148
msgid "contactFormSubmit"
msgstr ""

#: :144
msgid "contactFormTosAccepted"
msgstr ""

#: :33
msgid "copyright"
msgstr ""

#: :185
#: src/gatsby-theme-mdx-suite-base/components/navigation/mobile.js:183
msgid "menu"
msgstr ""

#: :42
msgid "newsReadMore"
msgstr "Weiterlesen"

#: :64
msgid "next"
msgstr ""

#: :57
msgid "previous"
msgstr ""

#: :33
msgid "{0} min. to read"
msgstr ""
Loading

0 comments on commit 1d66850

Please sign in to comment.