Skip to content

Refactor and simplify styles and templates #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 85 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from 83 commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
90345c7
Update packages and use Script component
rogermparent Jun 20, 2022
4b29760
Add requirements for nginx buildpack
rogermparent Jun 20, 2022
c483e9a
Add script that cleans all but necessary files after build
rogermparent Jun 20, 2022
832b482
Fix(?) heroku script
rogermparent Jun 20, 2022
bdea96f
Remove script and just point nginx at path
rogermparent Jun 21, 2022
6a8199d
Make main layout body expand to full height
rogermparent Jun 22, 2022
60ce2cc
Add new homepage
rogermparent Jun 22, 2022
1b871e0
Replace postcss media and mixins with tailwind equivalents
rogermparent Jun 23, 2022
ce582e5
Improve layout and remove postcss media in JS
rogermparent Jun 28, 2022
9a0e02a
Merge branch 'main' of github.com:iterative/gatsby-theme-iterative in…
rogermparent Jul 5, 2022
1b435a4
Remove color mod and custom properties, replace headerIsScrolled
rogermparent Jul 5, 2022
3b77c18
Change how intersection observer is used to check for scrolled header
rogermparent Jul 5, 2022
619d27d
Move docs left toggle menu one z-index higher so it shows on super
rogermparent Jul 5, 2022
325ab87
Change layout to flex-based one that doesn't require advanced scroll …
rogermparent Jul 8, 2022
3288c72
Fix eslint
rogermparent Jul 8, 2022
2be0948
Add forced scroll height to homepage and use sentinel to collapse flex
rogermparent Jul 12, 2022
eda6379
Make slightly better homepage
rogermparent Jul 12, 2022
12d0fa7
Upgrade again
rogermparent Jul 19, 2022
7acb0d9
Merge branch 'main' of github.com:iterative/gatsby-theme-iterative in…
rogermparent Jul 19, 2022
06758d2
Move plausible script outside of Helmet
rogermparent Jul 19, 2022
bc4e02c
Merge branch 'update-and-script-component' of github.com:iterative/ga…
rogermparent Jul 19, 2022
8775d58
Remove unused import
rogermparent Jul 19, 2022
dcaea4e
Remove unused cssBase
rogermparent Jul 19, 2022
778bbad
Merge branch 'main' of github.com:iterative/gatsby-theme-iterative in…
rogermparent Jul 22, 2022
8b21219
Update packages
rogermparent Jul 22, 2022
dd76a5f
Merge branch 'main' into replace-postcss-with-tailwind
rogermparent Jul 27, 2022
9432f15
Merge branch 'main' of github.com:iterative/gatsby-theme-iterative in…
rogermparent Jul 27, 2022
c16402b
Remove template wrapping system
rogermparent Aug 4, 2022
b0639f5
Merge branch 'main' of github.com:iterative/gatsby-theme-iterative in…
rogermparent Aug 4, 2022
36307f6
Upgrade packages
rogermparent Aug 4, 2022
ec6720b
Merge in husky
rogermparent Aug 4, 2022
a827adb
Merge main and fix TS issues
rogermparent Aug 4, 2022
a68c8fe
Merge branch 'husky' of github.com:iterative/gatsby-theme-iterative i…
rogermparent Aug 4, 2022
3196c9e
Upgrade packages
rogermparent Aug 4, 2022
f5ea149
Remove unused files
rogermparent Aug 5, 2022
77a1583
Add rewrite rule for trailing slashes on the example server
rogermparent Aug 6, 2022
6be8e4e
Try just disabling trailingSlash
rogermparent Aug 6, 2022
c2475fe
Fix root
rogermparent Aug 6, 2022
e2ebc43
Remove useRedirect
rogermparent Aug 6, 2022
408ec88
Try another nginx rule
rogermparent Aug 6, 2022
b05289d
Use try_files
rogermparent Aug 6, 2022
a6302eb
Merge branch 'nginx-remove-trailing-slash' of github.com:iterative/ga…
rogermparent Aug 6, 2022
7289d03
Merge branch 'main' into replace-postcss-with-tailwind
rogermparent Aug 8, 2022
cc0a10b
Fix link styling by using our custom link component
rogermparent Aug 8, 2022
7e49c69
Update packages
rogermparent Aug 22, 2022
3958406
Use @sentry/gatsby
rogermparent Aug 23, 2022
ef48d00
Remove DEV_SSR plugin
rogermparent Aug 23, 2022
812c064
Use example URL and make max breakpoints unique placeholders
rogermparent Aug 23, 2022
68ff095
Merge branch 'main' of github.com:iterative/gatsby-theme-iterative in…
rogermparent Sep 29, 2022
13cc6ae
re-remove sentry
rogermparent Sep 29, 2022
800471b
Use classNames in long tailwind utility classes
rogermparent Sep 29, 2022
e74fe81
Fix right sidebar top margin
rogermparent Sep 30, 2022
ab0e16b
Tweak styles, fixing external link icon
rogermparent Sep 30, 2022
2e0023e
Make docs engine more configurable
rogermparent Sep 30, 2022
9fa155b
Try one way of fixing the header
rogermparent Oct 3, 2022
03952db
Refactor layout to fix some height, alert, and header bugs
rogermparent Oct 3, 2022
ef9d959
Fix scroll-past-the-end bug?
rogermparent Oct 3, 2022
85fbca4
Revert to flex sticky header and add padding
rogermparent Oct 12, 2022
2cbd073
Merge branch 'main' of github.com:iterative/gatsby-theme-iterative in…
rogermparent Oct 13, 2022
885a542
Fix header social icons
rogermparent Oct 13, 2022
ee5ddd3
Fix scroll-past-header bug and refactor header links
rogermparent Oct 14, 2022
57bd391
Add simpler method for hiding nav items
rogermparent Oct 15, 2022
c808e31
Ensure docs first h1 and right bar "content" header are aligned
rogermparent Oct 17, 2022
2262d86
use scroll-margin-top for anchor nav
rogermparent Oct 17, 2022
c9c4c12
Add margin:auto to home container
rogermparent Oct 17, 2022
5d2c21e
Refactor sidebar autoscrolling
rogermparent Oct 18, 2022
edd8118
Merge branch 'main' into replace-postcss-with-tailwind
rogermparent Oct 19, 2022
d94541a
Increase specificity of markdown list style rules
rogermparent Oct 19, 2022
4232cfc
Fix sticky sidebars
rogermparent Oct 19, 2022
ec37a43
Fix mobile sidebar scrolling
rogermparent Oct 19, 2022
f7145dc
Use fixed header and sticky sidebar to fix issues
rogermparent Oct 21, 2022
bf5ca67
Retweak padding and width of sidebar
rogermparent Oct 21, 2022
e97fd89
Use max height so sidebar isn't necessarily size of screen
rogermparent Oct 21, 2022
b8cf6c3
Tweak layout so docs look better at all heights
rogermparent Oct 21, 2022
2469818
Make right sidebar screen-height and sticky
rogermparent Oct 24, 2022
527d9ac
Reposition sidebar back in line with header
rogermparent Oct 24, 2022
b922bff
Fix mobile sidebar and content by adding explicit width
rogermparent Oct 25, 2022
808f2e5
Merge branch 'main' into replace-postcss-with-tailwind
rogermparent Oct 25, 2022
c0ed0eb
Fix args linker and make its targeted pages configurable
rogermparent Oct 28, 2022
53b97cd
Shift 10px of margin to right panel so buttons block has its own spacing
rogermparent Nov 3, 2022
24b3e99
Only add horizontal padding to markdown content after xs
rogermparent Nov 9, 2022
e461597
Merge branch 'main' into replace-postcss-with-tailwind
rogermparent Nov 9, 2022
e8eeeec
use pathname instead of slug
yathomasi Nov 9, 2022
2b94f91
Merge branch 'main' into replace-postcss-with-tailwind
rogermparent Nov 9, 2022
b10183b
v0.2.0
rogermparent Nov 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 34 additions & 13 deletions packages/example/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,39 @@
import React from 'react'
import { Link } from 'gatsby'
import cn from 'classnames'
import { PageProps } from 'gatsby'
import MainLayout from '@dvcorg/gatsby-theme-iterative/src/components/MainLayout'
import Link from '@dvcorg/gatsby-theme-iterative/src/components/Link'

export default function Home() {
export default function Home({ location }: PageProps) {
return (
<div>
<h1>Gatsby Theme: Iterative</h1>
<p>
Welcome to the documentation and example website for Iterative&apos;s
website engine!
</p>
<p>
This theme is primarily related to adding a documentation engine, which
you can see <Link to="/doc">here!</Link>
</p>
</div>
<MainLayout location={location}>
<div
className={cn(
'container',
'mx-auto',
'mt-14',
'px-4',
'py-14',
'flex',
'flex-col',
'justify-center',
'items-center'
)}
>
<h1 className={cn('text-2xl', 'font-bold', 'text-center', 'mb-5')}>
Gatsby Theme: Iterative
</h1>
<section className="text-lg">
<p>
Welcome to the documentation and example website for
Iterative&apos;s website engine!
</p>
<p>
This theme is primarily related to adding a documentation engine,
which you can see <Link href="/doc">here!</Link>
</p>
</section>
</div>
</MainLayout>
)
}
14 changes: 10 additions & 4 deletions packages/example/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
const themeConfig = require('@dvcorg/gatsby-theme-iterative/tailwind.config')

module.exports = {
content: ['./src/**/*.{js,jsx,ts,tsx}'],
...themeConfig,
content: [...themeConfig.content, './src/**/*'],
theme: {
extend: {}
},
plugins: []
...themeConfig.theme,
fontFamily: {
sans: ['Tahoma', 'Arial', 'sans-serif'],
mono: ['Consolas', '"Liberation Mono"', 'Menlo', 'Courier', 'monospace']
}
}
}
8 changes: 8 additions & 0 deletions packages/gatsby-theme-iterative/config-defaults.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const path = require('path')
module.exports = {
glossaryPath: path.resolve('content', 'docs', 'user-guide', 'basic-concepts'),
docsPath: path.resolve('content', 'docs'),
glossaryInstanceName: 'iterative-glossary',
docsInstanceName: 'iterative-docs',
argsLinkerPath: ['command-reference', `ref`, 'cli-reference']
}
2 changes: 0 additions & 2 deletions packages/gatsby-theme-iterative/config/postcss/media.d.ts

This file was deleted.

19 changes: 0 additions & 19 deletions packages/gatsby-theme-iterative/config/postcss/media.js

This file was deleted.

115 changes: 0 additions & 115 deletions packages/gatsby-theme-iterative/config/postcss/mixins.js

This file was deleted.

9 changes: 5 additions & 4 deletions packages/gatsby-theme-iterative/createPages.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const GithubSlugger = require('github-slugger')
const slugger = new GithubSlugger()
const SLUG_REGEXP = /\s+{#([a-z0-9-]*[a-z0-9]+)}\s*$/

const path = require('path')

const extractSlugFromTitle = title => {
// extracts expressions like {#too-many-files} from the end of a title
const meta = title.match(SLUG_REGEXP)
Expand Down Expand Up @@ -34,7 +36,7 @@ const parseHeadings = text => {

const createPages = async (
{ graphql, actions },
{ defaultTemplate, getTemplate, disable }
{ defaultTemplate, getTemplate, disable, docsPrefix }
) => {
if (disable) return
const docsResponse = await graphql(
Expand Down Expand Up @@ -73,14 +75,13 @@ const createPages = async (
} = doc
const headings = parseHeadings(rawMarkdownBody)

if (slug) {
if (slug !== undefined) {
actions.createPage({
component: getTemplate(template, defaultTemplate),
path: slug,
path: path.posix.join(docsPrefix, slug),
context: {
id,
slug,
isDocs: true,
headings
}
})
Expand Down
3 changes: 0 additions & 3 deletions packages/gatsby-theme-iterative/gatsby-browser.js

This file was deleted.

60 changes: 21 additions & 39 deletions packages/gatsby-theme-iterative/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,6 @@ const fs = require('fs')
const path = require('path')

const autoprefixer = require('autoprefixer')
const customMedia = require('postcss-custom-media')
const customProperties = require('postcss-custom-properties')
const mixins = require('postcss-mixins')
const colorMod = require('postcss-color-mod-function')

const mediaConfig = require('./config/postcss/media')
const mixinsConfig = require('./config/postcss/mixins')

const defaultCssBase = path.join(
__dirname,
'src',
'components',
'Page',
'base.css'
)

const customYoutubeTransformer = require('./config/gatsby-remark-embedder/custom-yt-embedder')

Expand All @@ -31,26 +16,20 @@ require('./config/prismjs/dvctable')

const imageMaxWidth = 700

const defaults = require('./config-defaults')

module.exports = ({
simpleLinkerTerms,
cssBase = defaultCssBase,
customMediaConfig = { importFrom: [mediaConfig] },
customPropertiesConfig = {
importFrom: [cssBase],
disableDeprecationNotice: true
},
colorModConfig = {
importFrom: [cssBase]
},
postCssPlugins = [
require('tailwindcss/nesting')(require('postcss-nested')),
customMedia(customMediaConfig),
mixins(mixinsConfig),
customProperties(customPropertiesConfig),
colorMod(colorModConfig),
autoprefixer,
require('tailwindcss')
Comment on lines 21 to 26
Copy link
Contributor Author

@rogermparent rogermparent Aug 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's all tailwind now. Well, that and autoprefixer.

]
],
docsInstanceName = defaults.docsInstanceName,
docsPath = defaults.docsPath,
glossaryInstanceName = defaults.glossaryInstanceName,
glossaryPath = defaults.glossaryPath,
argsLinkerPath = defaults.argsLinkerPath
}) => ({
plugins: [
{
Expand All @@ -68,11 +47,18 @@ module.exports = ({
},
'gatsby-plugin-react-helmet',
'gatsby-plugin-sitemap',
{
glossaryInstanceName && {
resolve: 'gatsby-source-filesystem',
options: {
name: 'content',
path: path.resolve('content')
name: glossaryInstanceName,
path: glossaryPath
}
},
docsInstanceName && {
resolve: 'gatsby-source-filesystem',
options: {
name: docsInstanceName,
path: docsPath
}
},
'gatsby-plugin-image',
Expand All @@ -97,11 +83,7 @@ module.exports = ({
options: {
icon: linkIcon,
// Pathname can also be array of paths. eg: ['docs/command-reference;', 'docs/api']
pathname: [
'docs/command-reference',
`docs/ref`,
'docs/cli-reference'
]
pathname: argsLinkerPath
}
},
{
Expand Down Expand Up @@ -169,10 +151,10 @@ module.exports = ({
}
}
}
],
].filter(Boolean),
siteMetadata: {
author: 'Iterative',
siteUrl: 'https://cml.dev',
siteUrl: 'https://example.com',
titleTemplate: ''
}
})
16 changes: 12 additions & 4 deletions packages/gatsby-theme-iterative/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const path = require('path')
const { name: packageName } = require('./package.json')
const defaults = require('./config-defaults')

const defaultGetTemplate = (template, defaultTemplate) =>
template
Expand All @@ -15,7 +16,13 @@ exports.pluginOptionsSchema = ({ Joi }) => {
),
remark: Joi.boolean().default(true),
filesystem: Joi.boolean().default(true),
glossaryDirectory: Joi.string().default('docs/user-guide/basic-concepts'),
glossaryDirectory: Joi.string().default(
path.resolve('content', 'docs', 'user-guide', 'basic-concepts')
),
docsDirectory: Joi.string().default(path.resolve('content', 'docs')),
glossaryInstanceName: Joi.string().default('iterative-glossary'),
docsInstanceName: Joi.string().default('iterative-docs'),
docsPrefix: Joi.string().default('doc'),
simpleLinkerTerms: Joi.array().items(
Joi.object({
matches: Joi.string(),
Expand All @@ -24,9 +31,10 @@ exports.pluginOptionsSchema = ({ Joi }) => {
),
cssBase: Joi.string(),
customMediaConfig: Joi.object(),
customPropertiesConfig: Joi.object(),
colorModConfig: Joi.object(),
postCssPlugins: Joi.array()
postCssPlugins: Joi.array(),
argsLinkerPath: Joi.alternatives()
.try(Joi.string(), Joi.array().items(Joi.string()))
.default(defaults.argsLinkerPath)
})
}

Expand Down
Loading