Browse Source

feat: add action, clean up

fix/enable-imgix
Thomas Osmonson 4 years ago
parent
commit
aa03739b22
  1. 66
      .github/workflows/deploy.yml
  2. 1
      .vercelignore
  3. 50
      src/components/home/sections/code.tsx
  4. 83
      src/components/home/sections/cta.tsx
  5. 80
      src/components/home/sections/hero.tsx
  6. 53
      src/components/home/sections/patterns.tsx
  7. 51
      src/pages/index.tsx

66
.github/workflows/deploy.yml

@ -0,0 +1,66 @@
name: Deploy preview
on: [push, pull_request]
jobs:
vercel-deployment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Vercel action
uses: amondnet/vercel-action@v19.0.1+1
id: vercel-deployment-preview
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
scope: ${{ secrets.VERCEL_SCOPE }}
- name: Comment on PR
uses: actions/github-script@v2
id: comment
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const firstLine = `The Blockstack docs have been deployed with Vercel using the code from this PR!`;
let comment = undefined;
try {
const comments = await github.paginate(
'GET /repos/:owner/:repo/issues/:issue_number/comments',
{ ...context.repo, issue_number: context.issue.number},
response => response.data.map(issue => issue.body)
);
comment = comments.find((c) =>
c.body.includes(firstLine)
);
} catch(e) {
console.log('Comment could not be made!', e)
}
const commentId = comment && comment.id || undefined;
const commentBody = `
#### Deploy preview ready!
${firstLine}
- [Click here to view the deploy preview.](${{ steps.vercel-deployment-preview.outputs.preview-url }})
Built with commit ${context.sha}.
`;
if(context.issue.number){
if (commentId) {
await github.issues.updateComment({
...context.repo,
comment_id: commentId,
body: commentBody,
});
} else {
await github.issues.createComment({
...context.repo,
issue_number: context.issue.number,
body: commentBody,
});
}
}

1
.vercelignore

@ -1,3 +1,4 @@
.github
.next
.vercel
.mdx-data

50
src/components/home/sections/code.tsx

@ -1,50 +0,0 @@
import React from 'react';
import { Box, Flex, space } from '@blockstack/ui';
import { ExampleComponent } from '@components/example';
import { CodeExamples } from '@components/home/code-examples';
import { BodyLarge, H2 } from '@components/home/text';
import { Section, SectionWrapper } from '@components/home/common';
export const CodeSection = () => {
return (
<Section mt="64px" pb={0}>
<Box
minHeight={['790px', '650px', '400px', '400px']}
bg="black"
width="100%"
position="absolute"
top={0}
left={0}
/>
<SectionWrapper>
<Flex
flexDirection={['column', 'row', 'column', 'column']}
align={['unset', 'center', 'unset', 'unset']}
>
<Box mb={space(['base-loose', 'none', 'none', 'none'])}>
<H2 color="white" mb={space('extra-loose')}>
Iterate quickly
</H2>
<BodyLarge minWidth="16ch" color="white" mb={space('extra-loose')}>
Build complex UI easily with primitives and highly composable components.
</BodyLarge>
</Box>
<Box
display={['block', 'block', 'none', 'none']}
mb={space('extra-loose')}
pl={space(['none', 'base-loose', 'base-loose', 'base-loose'])}
flexShrink={0}
position="relative"
>
<ExampleComponent opacity={0} />
<ExampleComponent top={0} position="absolute" />
</Box>
</Flex>
<CodeExamples />
</SectionWrapper>
</Section>
);
};
export default CodeSection;

83
src/components/home/sections/cta.tsx

@ -1,83 +0,0 @@
import React from 'react';
import { Box, Grid, space, color, themeColor } from '@blockstack/ui';
import { CONTENT_MAX_WIDTH } from '@common/constants';
import { BoxIcon } from '@components/icons/box';
import { StackIcon } from '@components/icons/stack';
import { PackageIcon } from '@components/icons/package';
import { Card } from '@components/home/card';
import { Body, SubHeading, H2 } from '@components/home/text';
import { CircleIcon, Section, SectionWrapper } from '@components/home/common';
export const CTASection = () => (
<Section bg={color('invert')} minHeight="320px">
<SectionWrapper>
<H2 mb={space('extra-loose')} mx="auto" textAlign="center" color="white">
Get started with Blockstack UI
</H2>
<Grid
maxWidth={`${CONTENT_MAX_WIDTH}px`}
width="100%"
gridGap={space('extra-loose')}
minHeight="200px"
gridTemplateColumns={['repeat(1, 1fr)', 'repeat(1, 1fr)', 'repeat(3, 1fr)']}
mx="auto"
pt={space('extra-loose')}
>
<Card dark href="/getting-started" textAlign="center">
{({ hover, active }) => (
<Box>
<CircleIcon
icon={PackageIcon}
dark
hover={hover}
mx="auto"
mb={space('base-loose')}
/>
<SubHeading
color={hover || active ? themeColor('blue.400') : 'white'}
mb={space('base-loose')}
>
Installation & usage
</SubHeading>
<Body color={themeColor('ink.300')}>
Our getting started guide, add Blockstack UI to your app.
</Body>
</Box>
)}
</Card>
<Card dark href="/design-graph/system-props" textAlign="center">
{({ hover, active }) => (
<Box>
<CircleIcon hover={hover} icon={StackIcon} dark mx="auto" mb={space('base-loose')} />
<SubHeading
color={hover || active ? themeColor('blue.400') : 'white'}
mb={space('base-loose')}
>
System props
</SubHeading>
<Body color={themeColor('ink.300')}>
See how to use props to style your components.
</Body>
</Box>
)}
</Card>
<Card dark href="/components/box" textAlign="center">
{({ hover, active }) => (
<Box>
<CircleIcon hover={hover} icon={BoxIcon} dark mx="auto" mb={space('base-loose')} />
<SubHeading
color={hover || active ? themeColor('blue.400') : 'white'}
mb={space('base-loose')}
>
Box component
</SubHeading>
<Body color={themeColor('ink.300')}>
Learn about the base component everything is built with.
</Body>
</Box>
)}
</Card>
</Grid>
</SectionWrapper>
</Section>
);

80
src/components/home/sections/hero.tsx

@ -8,7 +8,7 @@ import { EditIcon } from '@components/icons/edit';
import { Card } from '@components/home/card';
import { Body, H1, BodyLarge, SubHeading } from '@components/home/text';
export const Hero = () => {
export const Hero = ({ cards }: { cards?: any }) => {
return (
<>
<Grid pb="64px" pt="128px" style={{ placeItems: 'center' }} mt="50px">
@ -25,61 +25,37 @@ export const Hero = () => {
width="100%"
gridGap={space('extra-loose')}
minHeight="200px"
gridTemplateColumns={['repeat(1, 1fr)', 'repeat(1, 1fr)', 'repeat(3, 1fr)']}
gridTemplateColumns={['repeat(1, 1fr)', 'repeat(2, 1fr)', 'repeat(3, 1fr)']}
mx="auto"
mt={space('extra-loose')}
px={space('extra-loose')}
>
<Card href="/design-graph/what-is-it" textAlign="center">
{({ hover, active }) => (
<Box as="span">
<CircleIcon
as="span"
hover={hover}
icon={AtomAltIcon}
mx="auto"
mb={space('base-loose')}
/>
<SubHeading
as="span"
display="block"
color={hover || active ? color('accent') : color('text-title')}
mb={space('base-loose')}
>
Build an app
</SubHeading>
<Body as="p">Start building your own decentralized app.</Body>
</Box>
)}
</Card>
<Card href="/components/box" textAlign="center">
{({ hover, active }) => (
<Box>
<CircleIcon hover={hover} icon={BoxIcon} mx="auto" mb={space('base-loose')} />
<SubHeading
color={hover || active ? color('accent') : color('text-title')}
mb={space('base-loose')}
>
Write a smart contract
</SubHeading>
<Body>Learn how to write your contract in the Clarity language.</Body>
</Box>
)}
</Card>
<Card href="/contributing" textAlign="center">
{({ hover, active }) => (
<Box>
<CircleIcon hover={hover} icon={EditIcon} mx="auto" mb={space('base-loose')} />
<SubHeading
color={hover || active ? color('accent') : color('text-title')}
mb={space('base-loose')}
>
View documentation
</SubHeading>
<Body>Dive in to learn all about developing on Blockstack.</Body>
</Box>
)}
</Card>
{cards.map(({ href, title, subtitle, icon: Icon }, index) => (
<Card href={href} textAlign="center" key={index}>
{({ hover, active }) => (
<Box as="span">
<CircleIcon
as="span"
hover={hover}
icon={Icon}
mx="auto"
mb={space('base-loose')}
/>
<SubHeading
as="span"
display="block"
color={hover || active ? color('accent') : color('text-title')}
mb={space('base-loose')}
>
{title}
</SubHeading>
<Body as="p" maxWidth="26ch" mx="auto">
{subtitle}
</Body>
</Box>
)}
</Card>
))}
</Grid>
</>
);

53
src/components/home/sections/patterns.tsx

@ -1,53 +0,0 @@
import React from 'react';
import { Grid, space } from '@blockstack/ui';
import { AccessibleIcon } from '@components/icons/accessible';
import { AtomIcon } from '@components/icons/atom';
import { PaletteIcon } from '@components/icons/palette';
import { PaintIcon } from '@components/icons/paint';
import { LayersIntersectIcon } from '@components/icons/layers-intersect';
import { H2 } from '@components/home/text';
import { GridItem } from '@components/home/grid';
import { Section, SectionWrapper } from '@components/home/common';
export const PatternsSection = () => (
<Section>
<SectionWrapper>
<H2 mb={space('extra-loose')}>Patterns & Principles</H2>
<Grid
width="100%"
mt="64px"
mb={space('base-loose')}
gridGap={space('extra-loose')}
gridRowGap={'64px'}
gridTemplateColumns={['repeat(1, 1fr)', 'repeat(2, 1fr)', 'repeat(3, 1fr)']}
gridTemplateRows={['repeat(1, 1fr)', 'repeat(1, 1fr)', 'repeat(2, 1fr)']}
>
<GridItem
icon={AccessibleIcon}
title="Accessible"
body="Blockstack UI follows WAI-ARIA standards. All components come with proper attributes and keyboard interactions out of the box."
/>
<GridItem
icon={AtomIcon}
title="Base primitives"
body="All components are built with a set of primitives that can take any css property as a prop for on-the-fly adjustments."
/>
<GridItem
icon={PaletteIcon}
title="Design graph"
body="Components built out of constraints, using token based design: scales of sizes, colors, and other variables."
/>
<GridItem
icon={PaintIcon}
title="Theming"
body="Blockstack UI is built with the Theme UI Spec in mind, allowing for theming such as light and dark modes."
/>
<GridItem
icon={LayersIntersectIcon}
title="Composability"
body="All components are built with composition in mind. Combine any components to build complex UI."
/>
</Grid>
</SectionWrapper>
</Section>
);

51
src/pages/index.tsx

@ -2,6 +2,55 @@ import React from 'react';
import Head from 'next/head';
import { HomeLayout } from '@components/layouts/home';
import { Hero } from '@components/home/sections/hero';
import { AtomAltIcon } from '@components/icons/atom-alt';
import { BoxIcon } from '@components/icons/box';
import { EditIcon } from '@components/icons/edit';
interface Card {
title: string;
subtitle: string;
href: string;
icon: React.FC<any>;
}
const cards = [
{
title: 'Build an app',
subtitle: 'Start building your own decentralized app.',
href: '/browser/todo-list',
icon: AtomAltIcon,
},
{
title: 'Write a smart contract',
subtitle: 'Learn how to write your contract in the Clarity language.',
href: '/core/smart/overview',
icon: AtomAltIcon,
},
{
title: 'Stacks blockchain',
subtitle: 'Learn how to work with nodes, namespaces, zone files, and other advanced topics.',
href: '/core/naming/introduction',
icon: AtomAltIcon,
},
{
title: 'Gaia storage',
subtitle: 'Learn about storage, interactions between developer APIs, and the Gaia service.',
href: '/storage/overview',
icon: AtomAltIcon,
},
{
title: 'Evaluate the ecosystem',
subtitle:
'Learn the components that make up the Blockstack Ecosystem. Understand the value a blockchain offers.',
href: '/org/overview',
icon: AtomAltIcon,
},
{
title: 'Join the community',
subtitle: 'View upcoming events and become a contributor or evangelist.',
href: '/common/community_ref',
icon: AtomAltIcon,
},
];
const Homepage = () => (
<>
@ -9,7 +58,7 @@ const Homepage = () => (
<title>Blockstack Docs</title>
</Head>
<HomeLayout>
<Hero />
<Hero cards={cards} />
</HomeLayout>
</>
);

Loading…
Cancel
Save