forked from neo-one-suite/neo-one
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(Reference): Create pages for all possible types.
Create all components necessary to create reference pages for all possible types (Function, Const, Class, Enum, Interface, Type Alias, Decorator). re neo-one-suite#691, neo-one-suite#692, neo-one-suite#693, neo-one-suite#694, neo-one-suite#695, neo-one-suite#696, neo-one-suite#697
- Loading branch information
1 parent
a361e7f
commit 5b5d825
Showing
25 changed files
with
589 additions
and
115 deletions.
There are no files selected for viewing
30 changes: 0 additions & 30 deletions
30
packages/neo-one-website/src/components/reference/ParameterList.tsx
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
packages/neo-one-website/src/components/reference/ReferenceContent.tsx
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
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
22 changes: 0 additions & 22 deletions
22
packages/neo-one-website/src/components/reference/ReferencePage.tsx
This file was deleted.
Oops, something went wrong.
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
17 changes: 17 additions & 0 deletions
17
packages/neo-one-website/src/components/reference/common/Text.tsx
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Box } from '@neo-one/react-common'; | ||
import * as React from 'react'; | ||
import styled from 'styled-components'; | ||
import { prop } from 'styled-tools'; | ||
import { WordTokens } from '../types'; | ||
import { buildText } from './utils'; | ||
|
||
export const StyledText = styled(Box)` | ||
${prop('theme.fontStyles.subheading')}; | ||
${prop('theme.fonts.axiformaRegular')}; | ||
`; | ||
|
||
interface Props { | ||
readonly text: WordTokens; | ||
} | ||
|
||
export const Text = ({ text, ...props }: Props) => <StyledText {...props}>{buildText(text)}</StyledText>; |
30 changes: 30 additions & 0 deletions
30
packages/neo-one-website/src/components/reference/common/TextSection.tsx
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Box } from '@neo-one/react-common'; | ||
import * as React from 'react'; | ||
import styled from 'styled-components'; | ||
import { prop } from 'styled-tools'; | ||
import { WordTokens } from '../types'; | ||
import { Text } from './Text'; | ||
import { Title } from './Title'; | ||
|
||
const Wrapper = styled(Box)` | ||
display: grid; | ||
grid-auto-flow: row; | ||
grid-gap: 32px; | ||
@media (max-width: ${prop('theme.breakpoints.md')}) { | ||
grid-gap: 16px; | ||
} | ||
`; | ||
|
||
interface Props { | ||
readonly title: string; | ||
readonly text: WordTokens; | ||
readonly subheading?: boolean; | ||
} | ||
|
||
export const TextSection = ({ title, text, subheading, ...props }: Props) => ( | ||
<Wrapper {...props}> | ||
<Title subheading={subheading}>{title}</Title> | ||
<Text text={text} /> | ||
</Wrapper> | ||
); |
9 changes: 9 additions & 0 deletions
9
packages/neo-one-website/src/components/reference/common/Title.tsx
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// stylelint-disable | ||
import { H2 } from '@neo-one/react-common'; | ||
import styled from 'styled-components'; | ||
import { ifProp, prop } from 'styled-tools'; | ||
|
||
export const Title = styled(H2)<{ readonly subheading?: boolean }>` | ||
${prop('theme.fonts.axiformaBold')}; | ||
${ifProp('subheading', prop('theme.fontStyles.headline'), prop('theme.fontStyles.display1'))}; | ||
`; |
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
5 changes: 5 additions & 0 deletions
5
packages/neo-one-website/src/components/reference/common/index.ts
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export * from './Example'; | ||
export * from './Text'; | ||
export * from './TextSection'; | ||
export * from './Title'; | ||
export * from './TypeIcon'; |
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
27 changes: 27 additions & 0 deletions
27
packages/neo-one-website/src/components/reference/components/Extra.tsx
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Box } from '@neo-one/react-common'; | ||
import * as React from 'react'; | ||
import styled from 'styled-components'; | ||
import { prop } from 'styled-tools'; | ||
import { Example, Text, Title } from '../common'; | ||
import { ExtraData } from '../types'; | ||
|
||
const Wrapper = styled(Box)` | ||
display: grid; | ||
grid-auto-flow: row; | ||
grid-gap: 32px; | ||
@media (max-width: ${prop('theme.breakpoints.md')}) { | ||
grid-gap: 16px; | ||
} | ||
`; | ||
|
||
interface Props { | ||
readonly data: ExtraData; | ||
} | ||
|
||
export const Extra = ({ data, ...props }: Props) => ( | ||
<Wrapper {...props}> | ||
{data.title === undefined ? undefined : <Title>{data.title}</Title>} | ||
{data.code ? <Example example={data.data} /> : <Text text={data.data} />} | ||
</Wrapper> | ||
); |
38 changes: 38 additions & 0 deletions
38
packages/neo-one-website/src/components/reference/components/InterfaceClassItems.tsx
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Box } from '@neo-one/react-common'; | ||
import * as React from 'react'; | ||
import styled from 'styled-components'; | ||
import { prop } from 'styled-tools'; | ||
import { Title } from '../common'; | ||
import { ClassData, InterfaceData } from '../types'; | ||
import { MethodItem } from './MethodItem'; | ||
import { MethodList } from './MethodList'; | ||
import { ParameterPropertyList } from './ParameterPropertyList'; | ||
|
||
export interface Props { | ||
readonly data: ClassData | InterfaceData; | ||
} | ||
|
||
const Wrapper = styled(Box)` | ||
display: grid; | ||
grid-auto-flow: row; | ||
grid-gap: 40px; | ||
@media (max-width: ${prop('theme.breakpoints.md')}) { | ||
grid-gap: 24px; | ||
} | ||
`; | ||
|
||
export const InterfaceClassItems = ({ data, ...props }: Props) => ( | ||
<Wrapper {...props}> | ||
{data.constructorDefinition === undefined ? ( | ||
undefined | ||
) : ( | ||
<Wrapper> | ||
<Title>Constructor</Title> | ||
<MethodItem method={data.constructorDefinition} /> | ||
</Wrapper> | ||
)} | ||
{data.properties === undefined ? undefined : <ParameterPropertyList values={data.properties} title="Properties" />} | ||
{data.methods === undefined ? undefined : <MethodList methods={data.methods} />} | ||
</Wrapper> | ||
); |
51 changes: 51 additions & 0 deletions
51
packages/neo-one-website/src/components/reference/components/MethodItem.tsx
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Box } from '@neo-one/react-common'; | ||
import * as React from 'react'; | ||
import styled from 'styled-components'; | ||
import { prop } from 'styled-tools'; | ||
import { Example, Text, Title } from '../common'; | ||
import { Method } from '../types'; | ||
import { ParameterReturns } from './ParameterReturns'; | ||
|
||
export interface Props { | ||
readonly method: Method; | ||
} | ||
|
||
const Layout = styled(Box)` | ||
display: grid; | ||
grid-auto-flow: row; | ||
grid-gap: 16px; | ||
background-color: ${prop('theme.gray1')}; | ||
border: 1px solid rgba(0, 0, 0, 0.3); | ||
@media (max-width: ${prop('theme.breakpoints.md')}) { | ||
grid-gap: 8px; | ||
} | ||
`; | ||
|
||
const Wrapper = styled(Box)` | ||
display: grid; | ||
grid-auto-flow: row; | ||
grid-gap: 16px; | ||
padding: 16px 32px; | ||
@media (max-width: ${prop('theme.breakpoints.md')}) { | ||
grid-gap: 8px; | ||
} | ||
`; | ||
|
||
const StyledTitle = styled(Title)` | ||
background-color: ${prop('theme.gray1')}; | ||
padding: 16px 32px; | ||
border-bottom: 1px solid rgba(0, 0, 0, 0.3); | ||
`; | ||
|
||
export const MethodItem = ({ method, ...props }: Props) => ( | ||
<Layout {...props}> | ||
<StyledTitle subheading>{method.title}</StyledTitle> | ||
<Wrapper> | ||
{method.description === undefined ? undefined : <Text text={method.description} />} | ||
<Example example={method.definition} /> | ||
<ParameterReturns functionData={method.functionData} subheading /> | ||
</Wrapper> | ||
</Layout> | ||
); |
30 changes: 30 additions & 0 deletions
30
packages/neo-one-website/src/components/reference/components/MethodList.tsx
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Box } from '@neo-one/react-common'; | ||
import * as React from 'react'; | ||
import styled from 'styled-components'; | ||
import { prop } from 'styled-tools'; | ||
import { Title } from '../common'; | ||
import { Method } from '../types'; | ||
import { MethodItem } from './MethodItem'; | ||
|
||
const ParameterLayout = styled(Box)` | ||
display: grid; | ||
grid-auto-flow: row; | ||
grid-gap: 32px; | ||
@media (max-width: ${prop('theme.breakpoints.md')}) { | ||
grid-gap: 16px; | ||
} | ||
`; | ||
|
||
interface Props { | ||
readonly methods: ReadonlyArray<Method>; | ||
} | ||
|
||
export const MethodList = ({ methods, ...props }: Props) => ( | ||
<ParameterLayout {...props}> | ||
<Title>Methods</Title> | ||
{methods.map((method) => ( | ||
<MethodItem key={method.title} method={method} /> | ||
))} | ||
</ParameterLayout> | ||
); |
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
Oops, something went wrong.