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

feat: #2612 style documentation page to look like elements #2672

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,5 @@ export const termsParent = css`
content: '(' counter(item, lower-alpha) ')';
}
}
/* [class*='terms-parent'] {
> .terms-child {
&:before {
content: counters(item, '.') ' ';
}
&.child-with-alpha-bullet {
&:before {
content: '(' counter(item, lower-alpha) ')';
}
}
}
} */
}
`
106 changes: 71 additions & 35 deletions packages/elements-next/doczrc.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,89 @@
// TODO - a start on theming - needs some work - ideally, should look like Elements itself
const colors = {
white: '#fff',
black: '#3b454e',
grey: '#74818d',
greyLight: '#dbdbdb',
greyLightest: '#f5f7f9',
green: '#a0c862',
greenLighter: '#acf2bd',
greenLightest: '#e6ffed',
red: '#d3033d',
redLighter: '#fdb8c0',
redLightest: '#ffeef0',
blue: '#0061a8',
blueDark: '#262f69',
blueDarkest: '#1e2554',
blueLight: '#23a4de',
blueLightest: '#7bc9eb',
orange: '#ec631b',
lime: '#cddb00',
teal: '#006580',
plumb: '#7a2c81',
purple: '#a4185c',
gold: '#ffb71b',
background: '#f5f7f9',
text: '#3b454e',
border: '#95aac9',
}

export default {
dest: '/public/dist',
typescript: true,
showDarkModeSwitch: false,
themeConfig: {
colors: {
text: '#3b454e',
background: '#fff',
primary: '#0061a8',
showDarkModeSwitch: true,
fontWeights: {
body: 400,
heading: 700,
bold: 700,
},
prism: {
plain: {
fontFamily: '"Source Code Pro", monospace',
color: '#393A34',
backgroundColor: '#f5f7f9',
},
lineHeights: {
body: 1.5,
heading: 1.125,
},
fontSizes: [12, 13, 13, 13, 24, 28, 32],
fonts: {
body: '"Roboto", sans-serif',
heading: '"Roboto", sans-serif',
monospace: '"Source Code Pro", monospace',
},
radii: {
square: 0,
radius: 0,
rounded: 0,
},
styles: {
h1: {
fontSize: '2rem',
fontFamily: 'heading',
fontWeight: 'heading',
color: 'text',
mt: 0,
mb: 4,
colors: {
primary: colors.blue,
text: colors.text,
muted: colors.gray,
link: colors.blue,
background: colors.background,
border: colors.border,
sidebar: {
bg: colors.white,
navGroup: colors.black,
navLink: colors.black,
navLinkActive: colors.blue,
tocLink: colors.black,
tocLinkActive: colors.black,
},
header: {
bg: colors.white,
text: colors.blue,
button: {
bg: colors.blue,
color: colors.white,
},
},
code: {
fontFamily: '"Source Code Pro", monospace',
playground: {
bg: colors.white,
border: colors.border,
},
inlineCode: {
fontFamily: '"Source Code Pro", monospace',
blockquote: {
color: colors.white,
},
pre: {
my: 4,
p: 3,
variant: 'prism',
textAlign: 'left',
fontFamily: '"Source Code Pro", monospace',
borderRadius: 'radius',
props: {
bg: colors.white,
text: colors.black,
highlight: colors.blue,
defaultValue: colors.gray,
descriptionText: colors.grayDark,
descriptionBg: colors.background,
},
},
},
Expand Down
8 changes: 5 additions & 3 deletions packages/elements-next/src/components/headings/headings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ name: Heading
route: /headings
---

import { Playground, Props } from 'docz'
import { Props } from 'docz'
import { Heading } from './headings'
import DocsWrapper from '@/docz/docs-wrapper'
import Playground from '@/components/playground'

# Heading
## Document
Headings are used as the titles of each major section of a page in the interface

## Properties
<Props of={Heading.Main} />

## Usage
Expand All @@ -20,4 +23,3 @@ import DocsWrapper from '@/docz/docs-wrapper'
<Heading.SubSecondary>SubHeading Secondary</Heading.SubSecondary>
</DocsWrapper>
</Playground>

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { css } from 'linaria'

export const playground = css`
[class*='NormalWrapper'] {
padding: 15px;
}
.copy-clipboard-wrapper {
overflow-x: auto;
}
`
2 changes: 2 additions & 0 deletions packages/elements-next/src/components/playground/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Playground from './playground'
export default Playground
13 changes: 13 additions & 0 deletions packages/elements-next/src/components/playground/playground.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as React from 'react'
import { Playground as BasePlayGround, PlaygroundProps } from 'docz'
import { playground } from './__styles__/playground-styles'

const PlayGround: React.FC<PlaygroundProps> = ({ children, ...rest }) => {
return (
<div className={playground}>
<BasePlayGround {...rest}>{children}</BasePlayGround>
</div>
)
}

export default PlayGround
5 changes: 3 additions & 2 deletions packages/elements-next/src/docz/styles/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const globalStyles = css`
kbd,
samp {
font-family: var(--font-monospace);
font-size: 1rem;
font-size: 13px;
}

a {
Expand Down Expand Up @@ -152,11 +152,12 @@ export const globalStyles = css`
}

[data-testid='playground'] {
font-size: 13px !important;
}

[data-testid='live-editor'] * {
font-family: var(--font-monospace, '"Source Code Pro", monospace') !important;
font-size: 1rem !important;
font-size: 13px !important;
}
}
}
Expand Down