mirror of https://github.com/lukechilds/docs.git
Thomas Osmonson
4 years ago
17 changed files with 149 additions and 57 deletions
@ -1,9 +1,11 @@ |
|||
import React from 'react'; |
|||
import { State } from '@components/app-state/types'; |
|||
import routes from '@common/routes'; |
|||
|
|||
export const initialState: State = { |
|||
mobileMenu: false, |
|||
activeSlug: '', |
|||
setState: (value: any) => null, |
|||
routes, |
|||
}; |
|||
export const AppStateContext = React.createContext<State>(initialState); |
|||
|
@ -0,0 +1,42 @@ |
|||
import React from 'react'; |
|||
import { Box, color, Grid, space } from '@blockstack/ui'; |
|||
import { onlyText } from '@common/utils'; |
|||
import { useAppState } from '@common/hooks/use-app-state'; |
|||
import { Text } from '@components/typography'; |
|||
import Link from 'next/link'; |
|||
export const PageReference = ({ children }) => { |
|||
const { routes } = useAppState(); |
|||
const content = onlyText(children).trim(); |
|||
const [variant, _paths] = content.includes('\n') ? content.split('\n') : ['default', content]; |
|||
const paths = _paths.includes(', ') ? _paths.split(', ') : [_paths]; |
|||
const flatRoutes = routes.flatMap(section => |
|||
section.routes.map(route => ({ |
|||
section: section.title, |
|||
...route, |
|||
})) |
|||
); |
|||
|
|||
const pages = paths |
|||
.map(path => flatRoutes.find(route => route.path === path)) |
|||
.filter(page => page); |
|||
return ( |
|||
<Grid |
|||
mt={space('extra-loose')} |
|||
gridColumnGap={space('loose')} |
|||
gridTemplateColumns="repeat(3, 1fr)" |
|||
> |
|||
{pages.map(page => ( |
|||
<Box position="relative"> |
|||
<Box mb={space('loose')} borderRadius="12px" height="144px" width="100%" bg="#9985FF" /> |
|||
<Box pb={space('tight')}> |
|||
<Text fontWeight="600">{page.title || page.headings[0]}</Text> |
|||
</Box> |
|||
<Box>{page.description}</Box> |
|||
<Link href={`/${page.path}`} passHref> |
|||
<Box as="a" position="absolute" size="100%" left={0} top={0} /> |
|||
</Link> |
|||
</Box> |
|||
))} |
|||
</Grid> |
|||
); |
|||
}; |
@ -1,12 +0,0 @@ |
|||
import React from 'react'; |
|||
import { Main } from '@components/main'; |
|||
|
|||
const HomeLayout: React.FC<any> = ({ children }) => { |
|||
return ( |
|||
<Main mx="unset" width={'100%'}> |
|||
{children} |
|||
</Main> |
|||
); |
|||
}; |
|||
|
|||
export { HomeLayout }; |
@ -0,0 +1,28 @@ |
|||
--- |
|||
title: 'Documentation' |
|||
--- |
|||
|
|||
# Documentation |
|||
|
|||
All you need to build decentralized apps and smart contracts |
|||
|
|||
## Get started |
|||
|
|||
[[page-reference | title]] |
|||
| browser/todo-list, core/smart/overview, core/smart/testnet-node |
|||
|
|||
## Tutorials |
|||
|
|||
[[page-reference]] |
|||
| browser/todo-list, core/smart/tutorial-counter |
|||
|
|||
## Explore |
|||
|
|||
[[page-reference]] |
|||
| org/overview, org/token |
|||
|
|||
## Sample projects |
|||
|
|||
Showcase your sample project |
|||
|
|||
[Submit on GitHub](https://github.com/blockstack/docs.blockstack) |
Loading…
Reference in new issue