This repository has been archived by the owner on Jan 24, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(docz-theme-default): change default theme code blocks style
- Loading branch information
1 parent
b1c3186
commit 86eda1e
Showing
6 changed files
with
55 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,31 @@ | ||
import * as React from 'react' | ||
import { Component } from 'react' | ||
|
||
interface RenderProps { | ||
render: (container: HTMLElement) => any | ||
} | ||
|
||
interface RenderState { | ||
container: HTMLElement | null | ||
} | ||
|
||
export class Render extends Component<RenderProps, RenderState> { | ||
private container: HTMLElement | null | ||
|
||
constructor(props: RenderProps) { | ||
super(props) | ||
this.container = null | ||
|
||
this.state = { | ||
container: null, | ||
} | ||
} | ||
|
||
public componentDidMount(): void { | ||
if (this.container) { | ||
this.setState({ container: this.container }) | ||
} | ||
} | ||
|
||
public render(): JSX.Element { | ||
const { render } = this.props | ||
const { container } = this.state | ||
|
||
return ( | ||
<div ref={node => (this.container = node)}> | ||
{container && render(container)} | ||
</div> | ||
) | ||
import { Fragment } from 'react' | ||
import { RenderComponent } from 'docz' | ||
import styled from 'react-emotion' | ||
|
||
import * as colors from '../styles/colors' | ||
|
||
const ComponentWrapper = styled('div')` | ||
position: relative; | ||
padding: 50px; | ||
background: white; | ||
border: 1px solid ${colors.GRAY}; | ||
border-radius: 3px 3px 0 0; | ||
` | ||
|
||
const CodeWrapper = styled('div')` | ||
border: 1px solid ${colors.GRAY}; | ||
border-top: 0; | ||
border-radius: 0 0 3px 3px; | ||
pre { | ||
border-radius: 0 0 3px 3px; | ||
} | ||
} | ||
` | ||
|
||
export const Render: RenderComponent = ({ component, code }) => ( | ||
<Fragment> | ||
<ComponentWrapper>{component}</ComponentWrapper> | ||
<CodeWrapper>{code}</CodeWrapper> | ||
</Fragment> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
import React from 'react' | ||
import { Route } from 'react-router-dom' | ||
import { Docs } from 'docz' | ||
import styled from 'react-emotion' | ||
|
||
import { Doc } from './Doc' | ||
|
||
const Wrapper = styled('div')` | ||
width: 100%; | ||
height: 100%; | ||
overflow-y: auto; | ||
` | ||
|
||
export const View = () => ( | ||
<Docs> | ||
{({ docs }) => | ||
docs.map(doc => ( | ||
<Route | ||
exact | ||
key={doc.id} | ||
path={doc.route} | ||
render={() => <Doc {...doc} />} | ||
/> | ||
)) | ||
} | ||
</Docs> | ||
<Wrapper> | ||
<Docs> | ||
{({ docs }) => | ||
docs.map(doc => ( | ||
<Route | ||
exact | ||
key={doc.id} | ||
path={doc.route} | ||
render={() => <Doc {...doc} />} | ||
/> | ||
)) | ||
} | ||
</Docs> | ||
</Wrapper> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import './styles' | ||
import './styles/prism-theme' | ||
|
||
import * as React from 'react' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters