Skip to content
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

docs: Improve typography of content #3141

Merged
merged 5 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions docs/app/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { notFound } from 'next/navigation';
import { Metadata } from 'next';
import { allContentPages } from 'contentlayer/generated';

import { Headline } from '@/ui';
import { Mdx } from '@/ui/mdx';

interface ContentPageProps {
Expand Down Expand Up @@ -51,8 +52,8 @@ export default async function ContentPage({ params }: ContentPageProps) {
}

return (
<article className="prose dark:prose-invert py-6">
<h1>{page.title}</h1>
<article className="prose py-6">
<Headline level="1">{page.title}</Headline>
<Mdx code={page.body.code} />
</article>
);
Expand Down
9 changes: 5 additions & 4 deletions docs/app/components/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import { notFound } from 'next/navigation';
import { Metadata } from 'next';
import { allComponentPages } from 'contentlayer/generated';

import { Headline } from '@/ui';
import { Mdx } from '@/ui/mdx';
import { MarigoldThemeSwitch, ThemeMenu } from './_components';

import { b2bTheme, coreTheme } from '@/theme';

import { MarigoldThemeSwitch, ThemeMenu } from './_components';

interface ComponentPageProps {
params: {
slug: string[];
Expand Down Expand Up @@ -59,8 +60,8 @@ export default async function ComponentPage({ params }: ComponentPageProps) {
}

return (
<article className="prose dark:prose-invert py-6">
<h1>{page.title}</h1>
<article className="prose py-6">
<Headline level="1">{page.title}</Headline>
<MarigoldThemeSwitch themes={themes} initial="b2bTheme">
<ThemeMenu />
<Mdx title={page.title} code={page.body.code} />
Expand Down
21 changes: 20 additions & 1 deletion docs/contentlayer.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,26 @@ export default makeSource({
rehypePlugins: [
[rehypeComponentDemo, { contentDirPath }],
rehypeSlug,
[rehypeAutolinkHeadings, { behavior: 'wrap' }],
[
rehypeAutolinkHeadings,
{
behavior: 'wrap',
properties: {
class: [
'relative',
'no-underline',
'before:absolute',
'before:-left-6',
'before:inset-y-0',
'before:flex',
'before:items-center',
'before:text-secondary-400',
'before:text-2xl',
`hover:before:content-['#']`,
].join(' '),
},
},
],
],
},
documentTypes: [ContentPage, ComponentPage],
Expand Down
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@marigold/eslint-config": "workspace:*",
"@marigold/icons": "workspace:*",
"@marigold/theme-preset": "workspace:*",
"@tailwindcss/typography": "0.5.9",
"autoprefixer": "10.4.14",
"contentlayer": "0.3.4",
"eslint": "8.44.0",
Expand Down
4 changes: 4 additions & 0 deletions docs/tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ const config: Config = {
'./ui/**/*.{js,ts,jsx,tsx,mdx}',
'./app/**/*.{js,ts,jsx,tsx,mdx}',

// Used for the anchor links
'./contentlayer.config.ts',

// Marigold components
'../packages/{components,system}/**/*.{tsx,ts}',
'!../packages/{components,system}/**/*.{stories,test}.{tsx,ts}',
],
presets: [preset],
plugins: [require('@tailwindcss/typography')],
};

export default config;
3 changes: 0 additions & 3 deletions docs/theme/components/Headline.styles.tsx

This file was deleted.

12 changes: 10 additions & 2 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"strictNullChecks": true,
"strictBindCallApply": true,
"strictFunctionTypes": false,
"strictPropertyInitialization": true,
"noImplicitAny": true,
"noImplicitThis": true,
"useUnknownInCatchVariables": true,
"forceConsistentCasingInFileNames": true,
"noUnusedLocals": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
Expand All @@ -24,7 +31,8 @@
"@/*": ["./*"],
"@marigold/*": ["../packages/*/src", "../themes/*/src"],
"contentlayer/generated": ["./.contentlayer/generated"]
}
},
"strict": false
},
"include": [
"**/*.ts",
Expand Down
4 changes: 2 additions & 2 deletions docs/ui/mdx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ const typography = {
// MDX Components
// ---------------
const components = {
...DocComponents,
...typography,
// TODO: wrap Marigold's Image/Link with next's image/link component
ComponentDemo,
Headline,
Message,
Text,
IconList,
...DocComponents,
...typography,
};

// Props
Expand Down
43 changes: 43 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.