Browse Source

feat: emotion, @stacks/ui & ui-core

feat/emotion-core-ui
Thomas Osmonson 4 years ago
parent
commit
af3c973e74
  1. 8
      babel.config.js
  2. 4
      next.config.js
  3. 55
      package.json
  4. 2
      src/common/hooks/use-lock-body-scroll.tsx
  5. 2
      src/common/hooks/use-media-query.tsx
  6. 4
      src/common/utils/index.ts
  7. 4
      src/components/app-wrapper.tsx
  8. 4
      src/components/back-button.tsx
  9. 2
      src/components/clarity-ref.tsx
  10. 2
      src/components/cli-reference.tsx
  11. 130
      src/components/color-modes/styles.tsx
  12. 11
      src/components/content-wrapper.tsx
  13. 32
      src/components/custom-blocks/page-reference.tsx
  14. 29
      src/components/example.tsx
  15. 22
      src/components/faq.tsx
  16. 16
      src/components/feedback.tsx
  17. 2
      src/components/footer.tsx
  18. 30
      src/components/glossary.tsx
  19. 47
      src/components/header.tsx
  20. 2
      src/components/home/card.tsx
  21. 17
      src/components/home/common.tsx
  22. 2
      src/components/home/footer.tsx
  23. 2
      src/components/home/grid.tsx
  24. 65
      src/components/home/sections/hero.tsx
  25. 59
      src/components/home/text.tsx
  26. 2
      src/components/hover-image.tsx
  27. 2
      src/components/icon-button.tsx
  28. 6
      src/components/icons/_base.tsx
  29. 5
      src/components/icons/accessible.tsx
  30. 6
      src/components/icons/atom.tsx
  31. 2
      src/components/icons/blockstack-logo.tsx
  32. 2
      src/components/icons/dark-mode.tsx
  33. 6
      src/components/icons/feedback.tsx
  34. 2
      src/components/icons/light-mode.tsx
  35. 2
      src/components/icons/magnifying-glass.tsx
  36. 6
      src/components/icons/package.tsx
  37. 6
      src/components/icons/paint.tsx
  38. 6
      src/components/icons/palette.tsx
  39. 2
      src/components/layouts/base-layout.tsx
  40. 37
      src/components/lazy-image.tsx
  41. 2
      src/components/main.tsx
  42. 26
      src/components/mdx/components/blockquote.tsx
  43. 30
      src/components/mdx/components/code.tsx
  44. 90
      src/components/mdx/components/heading.tsx
  45. 43
      src/components/mdx/components/link.tsx
  46. 2
      src/components/mdx/components/list.tsx
  47. 2
      src/components/mdx/components/section.tsx
  48. 2
      src/components/mdx/components/table.tsx
  49. 49
      src/components/mdx/components/typography.tsx
  50. 52
      src/components/mdx/image.tsx
  51. 26
      src/components/mdx/md-contents.tsx
  52. 220
      src/components/mdx/overrides.tsx
  53. 2
      src/components/mdx/styles.tsx
  54. 70
      src/components/mdx/typography.ts
  55. 4
      src/components/mobile-menu.tsx
  56. 26
      src/components/page-meta.tsx
  57. 12
      src/components/page-top.tsx
  58. 18
      src/components/pagination.tsx
  59. 15
      src/components/progress-bar.tsx
  60. 16
      src/components/search.tsx
  61. 39
      src/components/side-nav.tsx
  62. 12
      src/components/status-check.tsx
  63. 9
      src/components/toc.tsx
  64. 2
      src/components/tooltip.tsx
  65. 49
      src/components/typography.tsx
  66. 23
      src/pages/_app.tsx
  67. 65
      src/pages/_document.tsx
  68. 10
      src/pages/references/faqs/[slug].tsx
  69. 7
      src/pages/stacks-wallet/usage.md
  70. 27
      src/pages/storage-hubs/amazon-s3-deploy.md
  71. 11
      src/pages/storage-hubs/digital-ocean-deploy.md
  72. 23
      tsconfig.json
  73. 1048
      yarn.lock

8
babel.config.js

@ -1,8 +1,4 @@
module.exports = {
presets: ['next/babel'],
plugins: [
'./lib/babel-plugin-nextjs-mdx-patch',
'babel-plugin-macros',
['styled-components', { ssr: true }],
],
presets: ['next/babel', '@emotion/babel-preset-css-prop'],
plugins: ['./lib/babel-plugin-nextjs-mdx-patch', 'babel-plugin-macros', '@emotion'],
};

4
next.config.js

@ -394,6 +394,10 @@ module.exports = withFonts(
aliases.react = aliases['react-dom'] = 'preact/compat';
aliases['react-ssr-prepass'] = 'preact-ssr-prepass';
}
config.resolve.alias['@emotion/react'] = path.resolve(
__dirname,
'./node_modules/@emotion/react'
);
return config;
},

55
package.json

@ -2,19 +2,27 @@
"name": "@blockstack/docs",
"version": "1.0.0",
"dependencies": {
"@blockstack/ui": "2.12.2-beta.0",
"@docsearch/css": "^1.0.0-alpha.27",
"@docsearch/react": "^1.0.0-alpha.27",
"@emotion/babel-plugin": "^11.0.0-next.15",
"@emotion/babel-preset-css-prop": "^11.0.0-next.10",
"@emotion/cache": "^11.0.0-next.15",
"@emotion/core": "^11.0.0-next.10",
"@emotion/css": "^11.0.0-next.15",
"@emotion/react": "^11.0.0-next.15",
"@emotion/server": "^11.0.0-next.15",
"@hashicorp/remark-plugins": "^3.0.0",
"@mdx-js/loader": "1.6.16",
"@mdx-js/mdx": "^1.6.16",
"@mdx-js/react": "^1.6.16",
"@next/mdx": "^9.5.2",
"@reach/accordion": "^0.10.5",
"@reach/tooltip": "^0.10.5",
"@reach/accordion": "^0.11.0",
"@reach/tooltip": "^0.11.0",
"@stacks/ui": "^3.0.0-alpha.12",
"@stacks/ui-core": "^1.0.0-beta.6",
"@styled-system/theme-get": "^5.1.2",
"@types/mdx-js__react": "^1.5.2",
"@types/node": "^14.0.27",
"@types/node": "^14.6.2",
"@types/nprogress": "^0.2.0",
"@types/reach__tooltip": "^0.2.0",
"algoliasearch": "^4.4.0",
@ -22,9 +30,11 @@
"cache-manager": "^3.3.0",
"cache-manager-fs-hash": "^0.0.9",
"capsize": "^1.1.0",
"csstype": "^3.0.2",
"csstype": "^3.0.3",
"csvtojson": "^2.0.10",
"docsearch.js": "^2.6.3",
"emotion": "^10.0.27",
"emotion-server": "^10.0.27",
"fathom-client": "^3.0.0",
"front-matter": "^4.0.2",
"fs-extra": "^9.0.1",
@ -36,24 +46,25 @@
"lodash.debounce": "^4.0.8",
"mdi-react": "7.3.0",
"micro-memoize": "^4.0.9",
"modern-normalize": "^1.0.0",
"next": "^9.5.2",
"next-fonts": "^1.4.0",
"next-mdx-remote": "^0.6.0",
"next-mdx-remote": "^1.0.0",
"nprogress": "^0.2.0",
"p-all": "^3.0.0",
"preact": "^10.4.7",
"preact": "^10.4.8",
"preact-render-to-string": "^5.1.4",
"preact-ssr-prepass": "^1.1.1",
"prettier": "^2.0.5",
"prettier": "^2.1.1",
"preval.macro": "^5.0.0",
"react-gesture-responder": "^2.1.0",
"react-intersection-observer": "^8.26.2",
"react-intersection-observer": "^8.27.1",
"react-spring": "^8.0.27",
"remark": "^12.0.1",
"remark-custom-blocks": "^2.5.0",
"remark-emoji": "2.1.0",
"remark-external-links": "^6.1.0",
"remark-footnotes": "^1.0.0",
"remark-external-links": "^7.0.0",
"remark-footnotes": "^2.0.0",
"remark-frontmatter": "^2.0.0",
"remark-heading-id": "^1.0.0",
"remark-images": "2.0.0",
@ -65,9 +76,10 @@
"remark-unwrap-images": "2.0.0",
"remark-vscode": "^1.0.0-beta.2",
"strip-markdown": "^3.1.2",
"swr": "^0.3.0",
"stylis": "^4.0.2",
"swr": "^0.3.1",
"turndown": "^6.0.0",
"typescript": "^3.9.7",
"typescript": "^4.0.2",
"unified-vscode": "^1.0.0-beta.2",
"unist-builder": "^2.0.3",
"unist-util-is": "^4.0.2",
@ -82,14 +94,17 @@
"@blockstack/eslint-config": "^1.0.5",
"@blockstack/prettier-config": "^0.0.6",
"@next/bundle-analyzer": "^9.5.2",
"@typescript-eslint/eslint-plugin": "^4.0.1",
"@typescript-eslint/parser": "^4.0.1",
"babel-plugin-styled-components": "^1.11.0",
"eslint": "^7.6.0",
"eslint": "^7.8.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-prettier": "^3.1.4",
"husky": "^4.2.5",
"next-transpile-modules": "^4.0.2",
"next-transpile-modules": "^4.1.0",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"rimraf": "^3.0.2",
"styled-components": "^5.0.1",
"tsconfig-paths-webpack-plugin": "^3.3.0"
},
"private": true,
@ -111,8 +126,12 @@
},
"resolutions": {
"preact": "^10.4.4",
"@blockstack/ui": "2.12.2-beta.0",
"eslint": "^7.4.0"
"eslint": "^7.4.0",
"@emotion/cache": "^11.0.0-next.15",
"@emotion/core": "^11.0.0-next.10",
"@emotion/css": "^11.0.0-next.15",
"@emotion/react": "^11.0.0-next.15",
"@emotion/server": "^11.0.0-next.15"
},
"husky": {
"hooks": {

2
src/common/hooks/use-lock-body-scroll.tsx

@ -1,5 +1,5 @@
import React from 'react';
import { useSafeLayoutEffect } from '@blockstack/ui';
import { useSafeLayoutEffect } from '@stacks/ui';
export const useLockBodyScroll = (lock: boolean) => {
useSafeLayoutEffect(() => {

2
src/common/hooks/use-media-query.tsx

@ -1,5 +1,5 @@
import * as React from 'react';
import { useSafeLayoutEffect } from '@blockstack/ui';
import { useSafeLayoutEffect } from '@stacks/ui';
const isBrowser = typeof window !== 'undefined';

4
src/common/utils/index.ts

@ -1,7 +1,7 @@
import { Children, isValidElement, ReactNode, ReactElement, ReactText } from 'react';
import { Property } from 'csstype';
import { color } from '@blockstack/ui';
import { ColorsStringLiteral } from '@blockstack/ui';
import { color } from '@stacks/ui';
import { ColorsStringLiteral } from '@stacks/ui';
const camelToKebab = (string: string) =>
string

4
src/components/app-wrapper.tsx

@ -1,9 +1,7 @@
import React from 'react';
import { AppStateProvider } from '@components/app-state';
import { MdxOverrides } from '@components/mdx/overrides';
import { ProgressBar } from '@components/progress-bar';
import { BaseLayout } from '@components/layouts/base-layout';
import { ColorModes } from '@components/color-modes/styles';
import { Meta } from '@components/meta-head';
import { useFathom } from '@common/hooks/use-fathom';
@ -12,8 +10,6 @@ export const AppWrapper: React.FC<any> = ({ children, isHome }) => {
return (
<>
<Meta />
<MdxOverrides />
<ColorModes />
<ProgressBar />
<AppStateProvider>
<BaseLayout isHome={isHome}>{children}</BaseLayout>

4
src/components/back-button.tsx

@ -1,5 +1,5 @@
import React from 'react';
import { Flex, Box, color, space } from '@blockstack/ui';
import { Flex, Box, color, space } from '@stacks/ui';
import ArrowLeftIcon from 'mdi-react/ArrowLeftIcon';
import { Text } from '@components/typography';
import Link from 'next/link';
@ -21,7 +21,7 @@ export const BackButton = ({ href, ...rest }) => (
cursor: 'pointer',
color: color('text-title'),
}}
align="center"
alignItems="center"
as={href ? 'a' : 'div'}
display="flex !important"
{...rest}

2
src/components/clarity-ref.tsx

@ -2,7 +2,7 @@ import React from 'react';
import { Components } from '@components/mdx/mdx-components';
import { TableOfContents } from '@components/toc';
import hydrate from 'next-mdx-remote/hydrate';
import { space } from '@blockstack/ui';
import { space } from '@stacks/ui';
export const ClarityKeywordReference = React.memo(({ content, headings }: any) => {
return (

2
src/components/cli-reference.tsx

@ -1,7 +1,7 @@
import React from 'react';
import cliReferenceData from '../_data/cli-reference.json';
import { Components } from '@components/mdx/mdx-components';
import { Grid, Box, color } from '@blockstack/ui';
import { Grid, Box, color } from '@stacks/ui';
import { border, onlyText, slugify } from '@common/utils';
import hydrate from 'next-mdx-remote/hydrate';

130
src/components/color-modes/styles.tsx

@ -1,87 +1,53 @@
import { createGlobalStyle } from 'styled-components';
import { generateCssVariables } from '@blockstack/ui';
export const ColorModes = createGlobalStyle`
:root{
${generateCssVariables('light')};
--colors-highlight-line-bg: rgba(255,255,255,0.08);
}
* {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@media (prefers-color-scheme: dark) {
:root {
${generateCssVariables('dark')};
--colors-highlight-line-bg: rgba(255,255,255,0.04);
}
* {
-webkit-font-smoothing: subpixel-antialiased;
-moz-osx-font-smoothing: auto;
}
}
@media (prefers-color-scheme: light) {
:root {
${generateCssVariables('light')};
--colors-highlight-line-bg: rgba(255,255,255,0.08);
}
* {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
}
html, body, #__next {
background: var(--colors-bg);
border-color: var(--colors-border);
&.light {
${generateCssVariables('light')};
--colors-highlight-line-bg: rgba(255,255,255,0.08);
* {
/** @jsx jsx */
import * as React from 'react';
import { jsx, css, Global } from '@emotion/react';
import { theme, generateCssVariables } from '@stacks/ui';
export const Base = (
<Global
styles={css`
* {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
}
&.dark {
${generateCssVariables('dark')};
--colors-highlight-line-bg: rgba(255,255,255,0.04);
* {
-webkit-font-smoothing: subpixel-antialiased;
-moz-osx-font-smoothing: auto;
:root {
${generateCssVariables('light')({ colorMode: 'light', theme })};
--colors-highlight-line-bg: rgba(255, 255, 255, 0.1);
@media (prefers-color-scheme: dark) {
${generateCssVariables('dark')({ colorMode: 'dark', theme })};
--colors-highlight-line-bg: rgba(255, 255, 255, 0.05);
}
}
}
}
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
-webkit-text-fill-color: var(--colors-text-body);
font-size: 16px !important;
transition: background-color 5000s ease-in-out 0s;
}
input:-ms-input-placeholder,
textarea:-ms-input-placeholder {
color: var(--colors-input-placeholder) !important;
}
input::-ms-input-placeholder,
textarea::-ms-input-placeholder {
color: var(--colors-input-placeholder) !important;
}
html,
body,
#__next {
background: var(--colors-bg);
border-color: var(--colors-border);
&.light {
:root {
${generateCssVariables('light')({ colorMode: 'light', theme })};
--colors-highlight-line-bg: rgba(255, 255, 255, 0.1);
}
* {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
}
&.dark {
:root {
${generateCssVariables('dark')({ colorMode: 'dark', theme })};
--colors-highlight-line-bg: rgba(255, 255, 255, 0.04);
}
* {
-webkit-font-smoothing: subpixel-antialiased;
-moz-osx-font-smoothing: auto;
}
}
}
`}
/>
);
input::placeholder,
textarea::placeholder {
color: var(--colors-input-placeholder) !important;
}
`;
export const ColorModes = Base;

11
src/components/content-wrapper.tsx

@ -1,14 +1,19 @@
import React from 'react';
import { Flex, FlexProps, space } from '@blockstack/ui';
import { Flex, FlexProps, space } from '@stacks/ui';
import { ForwardRefExoticComponentWithAs, forwardRefWithAs } from '@stacks/ui-core';
const ContentWrapper: React.FC<FlexProps> = props => (
const ContentWrapper: ForwardRefExoticComponentWithAs<FlexProps, 'div'> = forwardRefWithAs<
FlexProps,
'div'
>((props, ref) => (
<Flex
flexShrink={0}
pt={space(['base', 'base', 'extra-loose'])}
pb={[4, 4, 6]}
flexDirection="column"
ref={ref}
{...props}
/>
);
));
export { ContentWrapper };

32
src/components/custom-blocks/page-reference.tsx

@ -1,5 +1,5 @@
import React from 'react';
import { Box, Flex, BoxProps, color, Grid, space } from '@blockstack/ui';
import { Box, Flex, BoxProps, color, Grid, space } from '@stacks/ui';
import { BlockstackLogo } from '@components/icons/blockstack-logo';
import { StackIcon } from '@components/icons/stack';
import { SitemapIcon } from '@components/icons/sitemap';
@ -9,7 +9,6 @@ import { Text } from '@components/typography';
import Link from 'next/link';
import { useAppState } from '@common/hooks/use-app-state';
import { Img } from '@components/mdx/image';
import { css } from '@styled-system/css';
import { getCapsizeStyles, getHeadingStyles } from '@components/mdx/typography';
const Image = ({
@ -42,13 +41,8 @@ const Image = ({
</Box>
);
const Title = ({ children, ...props }: BoxProps) => (
<Text
css={css({
...getHeadingStyles('h3'),
})}
{...props}
>
const Title: React.FC<BoxProps> = ({ children, ...props }) => (
<Text {...getHeadingStyles('h3')} {...props}>
{children}
</Text>
);
@ -56,11 +50,9 @@ const Title = ({ children, ...props }: BoxProps) => (
const Description = ({ children, ...props }) => (
<Text
{...props}
css={css({
...getCapsizeStyles(16, 26),
mt: space('base-tight'),
color: color('text-body'),
})}
{...getCapsizeStyles(16, 26)}
mt={space('base-tight')}
color={color('text-body')}
>
{children}
</Text>
@ -94,7 +86,7 @@ const InlineCard = ({ page }) => {
flexDirection={['column', 'row', 'row', 'row']}
p={space('base-loose')}
borderRadius="12px"
align="center"
alignItems="center"
transition={transition()}
boxShadow={hover ? 'mid' : 'none'}
position="relative"
@ -126,7 +118,7 @@ const InlineCard = ({ page }) => {
mt={space(['base', 'none', 'none', 'none'])}
textAlign={['center', 'left', 'left', 'left']}
>
<Flex align="baseline">
<Flex alignItems="baseline">
<Title
width={['100%', 'unset', 'unset', 'unset']}
color={hover ? color('accent') : color('text-title')}
@ -146,7 +138,7 @@ const InlineCard = ({ page }) => {
borderRadius="18px"
px={space('base-tight')}
height="20px"
align="center"
alignItems="center"
justify="center"
fontSize="12px"
bg={color('border')}
@ -175,7 +167,7 @@ const GridCardImage: React.FC<
bg="#9985FF"
position="relative"
borderRadius="12px"
mb={space('loose')}
marginBottom="base"
overflow="hidden"
{...props}
>
@ -225,6 +217,7 @@ const GridCard: React.FC<BoxProps & { page?: any }> = React.memo(({ page, ...res
alt={`Graphic for: ${page.title || page.headings[0]}`}
src={page?.images?.large}
isHovered={hover || active}
mb={'loose'}
/>
<GridItemDetails page={page} />
</Box>
@ -264,7 +257,7 @@ const GridSmallItem: React.FC<BoxProps & { page?: any }> = ({ page, ...rest }) =
{...rest}
{...bind}
>
{page.icon ? <Icon mb={space('base')} /> : null}
{page.icon ? <Icon mb={space('loose')} /> : null}
<GridItemDetails page={page} />
</Box>
);
@ -297,7 +290,6 @@ export const PageReference: React.FC<BoxProps> = React.memo(({ children, ...rest
return (
<Box {...rest}>
<Grid
display="grid"
width="100%"
gridColumnGap={space('extra-loose')}
gridRowGap={space('extra-loose')}

29
src/components/example.tsx

@ -10,7 +10,7 @@ import {
ChevronIcon,
themeColor,
FlexProps,
} from '@blockstack/ui';
} from '@stacks/ui';
import { Caption, Text } from '@components/typography';
import { border } from '@common/utils';
@ -33,7 +33,7 @@ const AppItem: React.FC<FlexProps & { name: string; usage: string }> = ({
...rest
}) => (
<ListItem {...rest}>
<Flex align="center">
<Flex alignItems="center">
<Box
bg={color('bg-alt')}
border={border()}
@ -43,7 +43,7 @@ const AppItem: React.FC<FlexProps & { name: string; usage: string }> = ({
/>
<Title>{name}</Title>
</Flex>
<Flex justify="flex-end" maxWidth="100px" align="center" flexGrow={1}>
<Flex justify="flex-end" maxWidth="100px" alignItems="center" flexGrow={1}>
<Caption>{usage}</Caption>
<ChevronIcon size="22px" color={color('text-caption')} direction="right" />
</Flex>
@ -52,7 +52,7 @@ const AppItem: React.FC<FlexProps & { name: string; usage: string }> = ({
const ListItem: React.FC<FlexProps> = props => (
<Flex
align="center"
alignItems="center"
justify="space-between"
borderBottom={border()}
pb={space('base')}
@ -73,18 +73,23 @@ export const ExampleComponent: React.FC<BoxProps> = props => (
width={['100%', '320px', '320px', '320px']}
{...props}
>
<Flex borderBottom={border()} p={space('base-loose')} justify="space-between" align="center">
<Flex
borderBottom={border()}
p={space('base-loose')}
justify="space-between"
alignItems="center"
>
<Title>Data storage</Title>
<Avatar border={border()} size="24px" />
</Flex>
<Box p={space('base-loose')}>
<Caption>Connected to</Caption>
<ListItem mt={space('base-tight')}>
<Flex align="center">
<Flex alignItems="center">
<BlockstackIcon color={color('accent')} mr={space('tight')} size="18px" />
<Title>My Gaia Hub</Title>
</Flex>
<Flex maxWidth="100px" align="center" flexGrow={1}>
<Flex maxWidth="100px" alignItems="center" flexGrow={1}>
<Progress mr={space('base')} amount={72} />
<ChevronIcon size="22px" color={color('text-caption')} direction="right" />
</Flex>
@ -106,7 +111,7 @@ export const exampleCode = `
borderRadius="lg"
width="320px">
<Flex
align="center"
alignItems="center"
justify="space-between"
p={space('base-loose')}
borderBottom={border()}>
@ -127,7 +132,7 @@ export const exampleCode = `
export const gaiaHubUsage = `
<ListItem>
<Flex align="center">
<Flex alignItems="center">
<BlockstackIcon
color={color('accent')}
mr={space('tight')}
@ -136,7 +141,7 @@ export const gaiaHubUsage = `
</Flex>
<Flex
maxWidth="100px"
align="center"
alignItems="center"
flexGrow={1}>
<Progress
mr={space('base')}
@ -150,7 +155,7 @@ export const gaiaHubUsage = `
export const appItem = `
<ListItem>
<Flex align="center">
<Flex alignItems="center">
<Box
bg={color('bg-alt')}
border={border()}
@ -163,7 +168,7 @@ export const appItem = `
<Flex
justify="flex-end"
maxWidth="100px"
align="center"
alignItems="center"
flexGrow={1}>
<Caption>{usage}</Caption>
<ChevronIcon

22
src/components/faq.tsx

@ -1,10 +1,9 @@
import React from 'react';
import { Box, space, color, Grid } from '@blockstack/ui';
import { Box, space, color, Grid } from '@stacks/ui';
import { Text } from '@components/typography';
import { slugify } from '@common/utils';
import { css } from '@styled-system/css';
import { getCapsizeStyles, getHeadingStyles } from '@components/mdx/typography';
import { HoverImage } from '../hover-image';
import { HoverImage } from '@components/hover-image';
import { useTouchable } from '@common/hooks/use-touchable';
import Link from 'next/link';
import { getBetterNames } from '@common/utils/faqs';
@ -29,22 +28,15 @@ const SectionCard = ({ section }) => {
<FloatingLink href="/references/faqs/[slug]" as={`/references/faqs/${slugify(title)}`} />
<HoverImage isHovered={hover || active} src={img} />
<Box>
<Text
css={css({
color: 'currentColor',
...getHeadingStyles('h3'),
})}
>
<Text color="currentColor" {...getHeadingStyles('h3')}>
{title}
</Text>
<Box>
<Text
css={css({
display: 'block',
color: color('text-body'),
mt: space('base-loose'),
...getCapsizeStyles(16, 26),
})}
display={'block'}
color={color('text-body')}
mt={space('base-loose')}
{...getCapsizeStyles(16, 26)}
>
{description}
</Text>

16
src/components/feedback.tsx

@ -9,7 +9,7 @@ import {
Stack,
transition,
SlideFade,
} from '@blockstack/ui';
} from '@stacks/ui';
import { Text } from '@components/typography';
import { Link } from '@components/mdx';
import { SadIcon, NeutralIcon, HappyIcon } from '@components/icons/feedback';
@ -17,7 +17,7 @@ import { useTouchable } from '@common/hooks/use-touchable';
import { border } from '@common/utils';
import { useRouter } from 'next/router';
import { getHeadingStyles } from '@components/mdx/typography';
import { css } from '@styled-system/css';
import { css } from '@stacks/ui-core';
import { StatusCheck } from '@components/status-check';
import { useColorMode } from '@common/hooks/use-color-mode';
@ -49,7 +49,7 @@ const FeedbackCard = ({ show, onClose }) => {
p={space('base')}
border={border()}
borderRadius="12px"
align="center"
alignItems="center"
justifyContent="center"
bg={color('bg')}
size="100%"
@ -108,13 +108,7 @@ export const FeedbackSection: React.FC<BoxProps> = props => {
>
<Flex>
<Box mt={space('extra-loose')} position="relative">
<Text
css={css({
...getHeadingStyles('h5'),
})}
>
Was this page helpful?
</Text>
<Text {...getHeadingStyles('h5')}>Was this page helpful?</Text>
<Stack isInline spacing={space('base-loose')} mt={space('base-loose')}>
<Icon onClick={() => handleShow()} icon={SadIcon} />
<Icon onClick={() => handleShow()} icon={NeutralIcon} />
@ -126,7 +120,7 @@ export const FeedbackSection: React.FC<BoxProps> = props => {
<Flex
flexDirection="column"
justifyContent="flex-end"
align="flex-end"
alignItems="flex-end"
mt={space(['extra-loose', 'extra-loose', 'base-loose'])}
>
<Link

2
src/components/footer.tsx

@ -1,5 +1,5 @@
import React from 'react';
import { space } from '@blockstack/ui';
import { space } from '@stacks/ui';
import { Pagination } from '@components/pagination';
import { Section, SectionWrapper } from '@components/home/common';
import { FeedbackSection } from '@components/feedback';

30
src/components/glossary.tsx

@ -1,9 +1,9 @@
import React from 'react';
import { Box, space } from '@blockstack/ui';
import { Box, space } from '@stacks/ui';
import hydrate from 'next-mdx-remote/hydrate';
import { Components } from '@components/mdx/mdx-components';
import { slugify } from '@common/utils';
import { css } from '@styled-system/css';
import { css } from '@stacks/ui-core';
import { TableOfContents } from '@components/toc';
export const Glossary = ({ data }) => {
@ -23,19 +23,19 @@ export const Glossary = ({ data }) => {
</Components.h3>
<Box
css={css({
width: '100%',
maxWidth: '48ch',
pl: space(['none', 'none', 'base-loose']),
'& p': {
display: 'block',
wordBreak: 'break-word',
hyphens: 'auto',
},
code: {
wordBreak: 'break-all',
},
})}
{...{ width: '100%', maxWidth: '48ch', pl: space(['none', 'none', 'base-loose']) }}
css={theme =>
css({
'& p': {
display: 'block',
wordBreak: 'break-word',
hyphens: 'auto',
},
code: {
wordBreak: 'break-all',
},
})(theme)
}
>
{hydrate(entry.definition, Components)}
</Box>

47
src/components/header.tsx

@ -10,13 +10,13 @@ import {
ChevronIcon,
FlexProps,
Fade,
} from '@blockstack/ui';
} from '@stacks/ui';
import { Link, LinkProps, Text } from '@components/typography';
import MenuIcon from 'mdi-react/MenuIcon';
import CloseIcon from 'mdi-react/CloseIcon';
import { useMobileMenuState } from '@common/hooks/use-mobile-menu';
import { css } from '@styled-system/css';
import { css, ForwardRefExoticComponentWithAs, forwardRefWithAs } from '@stacks/ui-core';
import NextLink from 'next/link';
import { ColorModeButton } from '@components/color-mode-button';
import { PAGE_WIDTH } from '@common/constants';
@ -41,7 +41,7 @@ const MenuButton = ({ ...rest }: any) => {
);
};
const HeaderWrapper: React.FC<BoxProps> = React.forwardRef((props, ref) => (
const HeaderWrapper: React.FC<BoxProps> = React.forwardRef((props, ref: any) => (
<Box as="header" ref={ref} width="100%" position="relative" zIndex={9999} {...props} />
));
@ -88,27 +88,30 @@ const nav: NavItem[] = [
export const HEADER_HEIGHT = 132;
const HeaderTextItem: React.FC<BoxProps & LinkProps> = ({ children, href, as, ...rest }) => (
const HeaderTextItem: ForwardRefExoticComponentWithAs<BoxProps & LinkProps, 'a'> = forwardRefWithAs<
BoxProps & LinkProps,
'a'
>(({ children, href, as = 'a', ...rest }, ref) => (
<Text
color={color('invert')}
css={css({
{...{
...getCapsizeStyles(16, 26),
color: 'currentColor',
...rest,
fontWeight: '400',
':hover': {
_hover: {
cursor: 'pointer',
textDecoration: href ? 'underline' : 'none',
color: href ? color('accent') : 'currentColor',
},
})}
}}
as={as}
// @ts-ignore
href={href}
ref={ref}
>
{children}
</Text>
);
));
const NavItem: React.FC<FlexProps & { item: NavItem }> = ({ item, ...props }) => {
const { hover, active, bind } = useTouchable({
@ -200,29 +203,21 @@ const Navigation: React.FC<BoxProps> = props => {
const LogoLink = () => {
const { hover, active, bind } = useTouchable();
const router = useRouter();
return (
<NextLink href="/" passHref>
<Link
as="a"
style={{
textDecoration: 'none',
pointerEvents: router.pathname === '/' ? 'none' : 'unset',
}}
{...bind}
>
<Flex as="span" align="center">
<Link _hover={{ textDecoration: 'none' }} as="a" display="flex" {...bind}>
<Flex as="span" alignItems="center">
<Box
as="span"
// opacity={hover || active ? 0.75 : 1}
color={hover || active ? color('accent') : color('invert')}
opacity={hover || active ? 0.75 : 1}
color={color('invert')}
mr={space('tight')}
>
<BlockstackIcon size="20px" />
</Box>
<Box as="span" transform="translateY(1px)">
<HeaderTextItem>Blockstack</HeaderTextItem>
</Box>
<HeaderTextItem as="span" transform="translateY(1px)">
Blockstack
</HeaderTextItem>
</Flex>
</Link>
</NextLink>
@ -236,7 +231,7 @@ const Header = ({ hideSubBar, ...rest }: any) => {
<Box mx="auto" px="extra-loose">
<Flex
justifyContent="space-between"
align="center"
alignItems="center"
bg={color('bg')}
style={{
backdropFilter: 'blur(5px)',
@ -248,7 +243,7 @@ const Header = ({ hideSubBar, ...rest }: any) => {
{...rest}
>
<LogoLink />
<Flex align="center">
<Flex alignItems="center">
<Navigation />
<ColorModeButton />
<MenuButton />

2
src/components/home/card.tsx

@ -1,5 +1,5 @@
import React from 'react';
import { Grid, Box, Flex, space, color, transition, FlexProps } from '@blockstack/ui';
import { Grid, Box, Flex, space, color, transition, FlexProps } from '@stacks/ui';
import NextLink from 'next/link';
import { useTouchable } from '@common/hooks/use-touchable';

17
src/components/home/common.tsx

@ -1,14 +1,23 @@
import React from 'react';
import { Box, Grid, Flex, BoxProps, transition, space, themeColor, color } from '@blockstack/ui';
import { GridProps } from '@blockstack/ui/dist/ui/src/grid/types';
import {
Box,
Grid,
Flex,
BoxProps,
transition,
space,
GridProps,
color,
FlexProps,
} from '@stacks/ui';
import { CONTENT_MAX_WIDTH } from '@common/constants';
export const CircleIcon: React.FC<
BoxProps & { icon: React.FC<any>; hover?: boolean; dark?: boolean }
FlexProps & { icon: React.FC<any>; hover?: boolean; dark?: boolean }
> = ({ size = '72px', icon: Icon, hover, dark, ...rest }) => (
<Flex
size={size}
align="center"
alignItems="center"
justify="center"
borderRadius={size}
bg={color(hover ? 'accent' : 'bg-alt')}

2
src/components/home/footer.tsx

@ -1,5 +1,5 @@
import React from 'react';
import { Box, BoxProps, Grid, space, themeColor } from '@blockstack/ui';
import { Box, BoxProps, Grid, space, themeColor } from '@stacks/ui';
import { Section, SectionWrapper } from '@components/home/common';
import { Text } from '@components/typography';

2
src/components/home/grid.tsx

@ -1,5 +1,5 @@
import React from 'react';
import { Box, space, color } from '@blockstack/ui';
import { Box, space, color } from '@stacks/ui';
import { Body, SubHeading } from '@components/home/text';
export const GridItem = ({ icon: Icon, title, body, ...rest }) => {

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

@ -1,65 +0,0 @@
import React from 'react';
import { Box, Grid, space, color } from '@blockstack/ui';
import { CircleIcon } from '@components/home/common';
import { CONTENT_MAX_WIDTH } from '@common/constants';
import { Card } from '@components/home/card';
import { Body, H1, BodyLarge, SubHeading } from '@components/home/text';
import { HEADER_HEIGHT } from '@components/header';
export const Hero = ({ cards }: { cards?: any }) => {
return (
<>
<Grid pb="64px" pt="64px" style={{ placeItems: 'center' }}>
<Box maxWidth="62ch" textAlign="center">
<H1 mb={space('base')}>Easily build decentralized apps</H1>
<BodyLarge maxWidth="42ch" mt="64px" mx="auto">
Blockstack is a developer-friendly toolkit for building decentralized apps, anchored in
the Bitcoin blockchain.
</BodyLarge>
</Box>
</Grid>
<Grid
maxWidth={`${CONTENT_MAX_WIDTH}px`}
width="100%"
gridGap={space('extra-loose')}
minHeight="200px"
gridTemplateColumns={[
'repeat(1, 1fr)',
'repeat(1, 1fr)',
'repeat(2, 1fr)',
'repeat(3, 1fr)',
]}
mx="auto"
mt={space('extra-loose')}
px={space('extra-loose')}
>
{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 || active}
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>
</>
);
};

59
src/components/home/text.tsx

@ -1,25 +1,25 @@
import React from 'react';
import { Box, BoxProps, color } from '@blockstack/ui';
import { Box, BoxProps, color } from '@stacks/ui';
import { Text } from '@components/typography';
import { css } from '@styled-system/css';
import { getCapsizeStyles } from '@components/mdx/typography';
export const H1: React.FC<BoxProps> = ({ children, ...rest }) => (
<Box {...rest}>
<Text
css={css({
{...{
color: color('text-title'),
display: 'block',
fontWeight: 'bolder',
fontSize: ['44px', '44px', '66px'],
lineHeight: ['48px', '48px', '68px'],
padding: '0.05px 0',
':before': {
_before: {
content: "''",
marginTop: ['-0.18295454545454543em', '-0.18295454545454543em', '-0.15227272727272725em'],
display: 'block',
height: 0,
},
':after': {
_after: {
content: "''",
marginBottom: [
'-0.18295454545454545em',
@ -29,7 +29,7 @@ export const H1: React.FC<BoxProps> = ({ children, ...rest }) => (
display: 'block',
height: 0,
},
})}
}}
as="h1"
>
{children}
@ -40,26 +40,26 @@ export const H1: React.FC<BoxProps> = ({ children, ...rest }) => (
export const H2: React.FC<BoxProps> = ({ children, ...rest }) => (
<Box {...rest}>
<Text
css={css({
{...{
color: color('text-title'),
display: 'block',
fontWeight: 'bold',
fontSize: '38.5px',
lineHeight: '42px',
padding: '0.05px 0',
':before': {
_before: {
content: "''",
marginTop: '-0.1831168831168831em',
display: 'block',
height: 0,
},
':after': {
_after: {
content: "''",
marginBottom: '-0.18311688311688312em',
display: 'block',
height: 0,
},
})}
}}
as="h1"
>
{children}
@ -69,26 +69,26 @@ export const H2: React.FC<BoxProps> = ({ children, ...rest }) => (
export const BodyLarge: React.FC<BoxProps> = ({ children, ...rest }) => (
<Text
as="h2"
css={css({
{...{
color: color('text-body'),
display: 'block',
fontSize: '22px',
lineHeight: '32px',
padding: '0.05px 0',
':before': {
_before: {
content: "''",
marginTop: '-0.3659090909090909em',
display: 'block',
height: 0,
},
':after': {
_after: {
content: "''",
marginBottom: '-0.3659090909090909em',
display: 'block',
height: 0,
},
...rest,
})}
}}
>
{children}
</Text>
@ -97,53 +97,32 @@ export const BodyLarge: React.FC<BoxProps> = ({ children, ...rest }) => (
export const SubHeading = ({ as, children, ...rest }: any) => (
<Text
as={as}
css={css({
{...{
display: 'block',
fontWeight: 600,
fontSize: '22px',
lineHeight: '28px',
padding: '0.05px 0',
':before': {
_before: {
content: "''",
marginTop: '-0.27499999999999997em',
display: 'block',
height: 0,
},
':after': {
_after: {
content: "''",
marginBottom: '-0.27499999999999997em',
display: 'block',
height: 0,
},
...rest,
})}
}}
>
{children}
</Text>
);
export const Body = ({ as, children, ...rest }: any) => (
<Text
as={as}
css={css({
display: 'block',
fontSize: '16.5px',
lineHeight: '24px',
padding: '0.05px 0',
':before': {
content: "''",
marginTop: '-0.3666666666666667em',
display: 'block',
height: 0,
},
':after': {
content: "''",
marginBottom: '-0.3666666666666667em',
display: 'block',
height: 0,
},
...rest,
})}
>
<Text as={as} {...getCapsizeStyles(16, 26)} {...rest}>
{children}
</Text>
);

2
src/hover-image.tsx → src/components/hover-image.tsx

@ -1,5 +1,5 @@
import React from 'react';
import { Box, BoxProps, Grid, space } from '@blockstack/ui';
import { Box, BoxProps, Grid, space } from '@stacks/ui';
import { transition } from '@common/utils';
import { Img } from '@components/mdx/image';

2
src/components/icon-button.tsx

@ -1,5 +1,5 @@
import React, { forwardRef, Ref } from 'react';
import { Box, color } from '@blockstack/ui';
import { Box, color } from '@stacks/ui';
import { LinkProps } from '@components/typography';
export const IconButton = forwardRef((props: LinkProps, ref: Ref<HTMLDivElement>) => (

6
src/components/icons/_base.tsx

@ -1,8 +1,6 @@
import React from 'react';
import { Box, BoxProps } from '@blockstack/ui';
import { SVGProps } from 'react';
export type SvgProps = React.FC<BoxProps & SVGProps<any>>;
import { Box, BoxProps } from '@stacks/ui';
export type SvgProps = React.FC<BoxProps>;
export const BaseSvg: SvgProps = props => (
<Box

5
src/components/icons/accessible.tsx

@ -1,8 +1,7 @@
import React from 'react';
import { Box, BoxProps } from '@blockstack/ui';
import { SVGProps } from 'react';
import { Box, BoxProps } from '@stacks/ui';
export const AccessibleIcon: React.FC<BoxProps & SVGProps<any>> = props => (
export const AccessibleIcon: React.FC<BoxProps> = props => (
<Box
as="svg"
width="44"

6
src/components/icons/atom.tsx

@ -1,8 +1,6 @@
import React from 'react';
import { Box, BoxProps } from '@blockstack/ui';
import { SVGProps } from 'react';
export const AtomIcon: React.FC<BoxProps & SVGProps<any>> = props => (
import { Box, BoxProps } from '@stacks/ui';
export const AtomIcon: React.FC<BoxProps> = props => (
<Box
as="svg"
width="44"

2
src/components/icons/blockstack-logo.tsx

@ -1,5 +1,5 @@
import React from 'react';
import { Box, BoxProps } from '@blockstack/ui';
import { Box, BoxProps } from '@stacks/ui';
export const BlockstackLogo = ({ size = '24px', ...props }: BoxProps) => (
<Box width={size} height={size} color="var(--colors-invert)" {...props}>

2
src/components/icons/dark-mode.tsx

@ -1,5 +1,5 @@
import React from 'react';
import { Box, BoxProps } from '@blockstack/ui';
import { Box, BoxProps } from '@stacks/ui';
export const DarkModeIcon = (props: BoxProps) => (
<Box {...props}>

6
src/components/icons/feedback.tsx

@ -1,8 +1,6 @@
import React from 'react';
import { Box, BoxProps, transition } from '@blockstack/ui';
import { SVGProps } from 'react';
export type SvgProps = React.FC<BoxProps & SVGProps<any>>;
import { Box, BoxProps, transition } from '@stacks/ui';
export type SvgProps = React.FC<BoxProps>;
export const SadIcon: SvgProps = ({ bg = '#E1E3E8', ...props }) => (
<Box

2
src/components/icons/light-mode.tsx

@ -1,5 +1,5 @@
import React from 'react';
import { Box, BoxProps } from '@blockstack/ui';
import { Box, BoxProps } from '@stacks/ui';
export const LightModeIcon = (props: BoxProps) => (
<Box {...props}>

2
src/components/icons/magnifying-glass.tsx

@ -1,6 +1,6 @@
import React from 'react';
import { Box, BoxProps } from '@blockstack/ui';
import { Box, BoxProps } from '@stacks/ui';
interface MagnifyingGlassProps extends BoxProps {
size?: number;

6
src/components/icons/package.tsx

@ -1,8 +1,6 @@
import React from 'react';
import { Box, BoxProps } from '@blockstack/ui';
import { SVGProps } from 'react';
export const PackageIcon: React.FC<BoxProps & SVGProps<any>> = props => (
import { Box, BoxProps } from '@stacks/ui';
export const PackageIcon: React.FC<BoxProps> = props => (
<Box
as="svg"
width="44"

6
src/components/icons/paint.tsx

@ -1,8 +1,6 @@
import React from 'react';
import { Box, BoxProps } from '@blockstack/ui';
import { SVGProps } from 'react';
export const PaintIcon: React.FC<BoxProps & SVGProps<any>> = props => (
import { Box, BoxProps } from '@stacks/ui';
export const PaintIcon: React.FC<BoxProps> = props => (
<Box
as="svg"
width="44"

6
src/components/icons/palette.tsx

@ -1,8 +1,6 @@
import React from 'react';
import { Box, BoxProps } from '@blockstack/ui';
import { SVGProps } from 'react';
export const PaletteIcon: React.FC<BoxProps & SVGProps<any>> = props => (
import { Box, BoxProps } from '@stacks/ui';
export const PaletteIcon: React.FC<BoxProps> = props => (
<Box
as="svg"
width="44"

2
src/components/layouts/base-layout.tsx

@ -1,5 +1,5 @@
import React from 'react';
import { Flex } from '@blockstack/ui';
import { Flex } from '@stacks/ui';
import { SideNav } from '../side-nav';
import { Header } from '../header';
import { Main } from '../main';

37
src/components/lazy-image.tsx

@ -1,8 +1,9 @@
import React from 'react';
import { Box, BoxProps, useSafeLayoutEffect } from '@blockstack/ui';
import { Box, BoxProps, useSafeLayoutEffect } from '@stacks/ui';
import { useSpring, animated, config } from 'react-spring';
import { useInView } from 'react-intersection-observer';
import { makeCancelable } from '@common/utils';
import { ForwardRefExoticComponentWithAs, forwardRefWithAs } from '@stacks/ui-core';
interface ImageProps {
/** The source of the image to load */
@ -56,14 +57,10 @@ const loadImage = (
}
});
export const LazyImage: React.FC<
BoxProps & {
src?: string;
srcSet?: string;
loading?: string;
placeholder?: string;
}
> = ({ src, srcSet, style = {}, placeholder, ...props }) => {
export const LazyImage: ForwardRefExoticComponentWithAs<BoxProps, 'img'> = forwardRefWithAs<
BoxProps,
'img'
>(({ as = 'img', src, srcSet, style = {}, placeholder, ...props }, forwardedRef) => {
const [ref, inView] = useInView({
triggerOnce: true,
rootMargin: '200px 0px',
@ -134,18 +131,20 @@ export const LazyImage: React.FC<
maxWidth="100%"
width={['100%', '100%', 'inherit', 'inherit']}
display="block"
as={animated.img}
as={(animated.img as unknown) as 'img'}
zIndex={99}
style={{
opacity: 0,
willChange: 'opacity',
...style,
...styleProps,
}}
{...source}
{...props}
style={
{
opacity: 0,
willChange: 'opacity',
...style,
...styleProps,
} as any
}
{...(source as any)}
{...(props as any)}
/>
) : null}
</Box>
);
};
});

2
src/components/main.tsx

@ -1,5 +1,5 @@
import React from 'react';
import { Box, BoxProps } from '@blockstack/ui';
import { Box, BoxProps } from '@stacks/ui';
const Main = (props: BoxProps) => <Box mx="auto" as="main" flexGrow={1} {...props} />;

26
src/components/mdx/components/blockquote.tsx

@ -1,8 +1,8 @@
import { Box, Flex, BoxProps, color, themeColor, space } from '@blockstack/ui';
import { Box, Flex, BoxProps, color, themeColor, space } from '@stacks/ui';
import React from 'react';
import { border } from '@common/utils';
import { css } from '@styled-system/css';
import { css } from '@stacks/ui-core';
import { CheckCircleIcon } from '@components/icons/check-circle';
import { AlertTriangleIcon } from '@components/icons/alert-triangle';
import { AlertCircleIcon } from '@components/icons/alert-circle';
@ -61,12 +61,12 @@ export const Blockquote: React.FC<BoxProps> = React.memo(
display="block"
my={space('extra-loose')}
className={className}
ref={ref}
ref={ref as any}
{...rest}
>
<Box
border="1px solid"
css={css({
{...{
position: 'relative',
display: 'grid',
placeItems: 'center',
@ -78,15 +78,19 @@ export const Blockquote: React.FC<BoxProps> = React.memo(
boxShadow: isAlert ? 'mid' : 'unset',
py: space('base'),
px: space('base'),
'& p': {
flexGrow: 1,
pt: '4px',
},
...styles,
})}
}}
css={theme =>
css({
'& p': {
flexGrow: 1,
pt: '4px',
},
})(theme)
}
{...styles}
>
{Icon && (
<Flex align="center" height="28x" flexShrink={0} color={accent} width="22px">
<Flex alignItems="center" height="28x" flexShrink={0} color={accent} width="22px">
<Box position="absolute" top="16px" size="22px">
<Icon />
</Box>

30
src/components/mdx/components/code.tsx

@ -1,9 +1,9 @@
import React, { Children } from 'react';
import { Box, Flex, BoxProps, color, space, useClipboard, themeColor } from '@blockstack/ui';
import { Box, Flex, BoxProps, color, space, useClipboard, themeColor } from '@stacks/ui';
import { ClipboardCheckIcon } from '@components/icons/clipboard-check';
import { border, onlyText } from '@common/utils';
import { css } from '@styled-system/css';
import { css } from '@stacks/ui-core';
import { Text } from '@components/typography';
import { useHover } from 'use-events';
import { IconButton } from '@components/icon-button';
@ -66,16 +66,23 @@ export const Code: React.FC<
>
<Box
as="code"
css={css({
{...{
width: '100%',
display: 'flex',
flexDirection: 'column',
minWidth: 'fit-content',
counterReset: 'line',
pr: space(['base-loose', 'base-loose', 'extra-loose', 'extra-loose']),
pl:
lines <= LINE_MINIMUM || lang === 'bash'
? space(['extra-loose', 'extra-loose', 'base-loose', 'base-loose'])
: 'unset',
}}
css={css({
'.token-line': {
display: 'inline-block',
...generateCssStylesForHighlightedLines(numbers),
},
counterReset: 'line',
'& .token-line': {
'&__empty': {
height: '24px',
@ -101,11 +108,6 @@ export const Code: React.FC<
}
: {},
},
pr: space(['base-loose', 'base-loose', 'extra-loose', 'extra-loose']),
pl:
lines <= LINE_MINIMUM || lang === 'bash'
? space(['extra-loose', 'extra-loose', 'base-loose', 'base-loose'])
: 'unset',
})}
{...rest}
>
@ -188,14 +190,12 @@ const preProps = {
export const InlineCode: React.FC<BoxProps> = ({ children, ...rest }) => (
<Text
as="code"
css={css({
// @ts-ignore
{...preProps}
{...{
fontSize: '14px',
// @ts-ignore
lineHeight: '20px',
...preProps,
...rest,
})}
}}
{...rest}
>
{children}
</Text>

90
src/components/mdx/components/heading.tsx

@ -1,4 +1,4 @@
import { Box, Flex, FlexProps, BoxProps, color, useClipboard, space } from '@blockstack/ui';
import { Box, Flex, FlexProps, BoxProps, color, useClipboard, space } from '@stacks/ui';
import React from 'react';
import LinkIcon from 'mdi-react/LinkVariantIcon';
@ -7,10 +7,10 @@ import { useTouchable } from '@common/hooks/use-touchable';
import { Tooltip } from '@components/tooltip';
import { useActiveHeading } from '@common/hooks/use-active-heading';
import { Title } from '@components/typography';
import { css } from '@styled-system/css';
import { getHeadingStyles, baseTypeStyles } from '@components/mdx/typography';
import { useRouter } from 'next/router';
import { Link } from '@components/mdx/components/link';
import { ForwardRefExoticComponentWithAs, forwardRefWithAs } from '@stacks/ui-core';
const LinkButton = React.memo(({ link, onClick, ...rest }: BoxProps & { link: string }) => {
const url =
@ -49,7 +49,7 @@ const LinkButton = React.memo(({ link, onClick, ...rest }: BoxProps & { link: st
});
// this is to adjust the offset of where the page scrolls to when an anchor is present
const AnchorOffset = ({ id }: BoxProps) =>
const AnchorOffset: React.FC<BoxProps & { id?: string }> = ({ id }) =>
id ? (
<Box
as="span"
@ -65,7 +65,7 @@ const Hashtag = () => (
<Flex
position="absolute"
as="span"
align="center"
alignItems="center"
size="20px"
left={['12px', '12px', '-20px', '-20px']}
color={color('text-caption')}
@ -74,51 +74,51 @@ const Hashtag = () => (
</Flex>
);
export const Heading = ({ as, children, id, ...rest }: FlexProps) => {
const { isActive, doChangeActiveSlug } = useActiveHeading(id);
export const Heading: ForwardRefExoticComponentWithAs<
FlexProps,
'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
> = forwardRefWithAs<FlexProps, 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'>(
({ as, children, id, ...rest }) => {
const { isActive, doChangeActiveSlug } = useActiveHeading(id);
const { bind: _bind, hover, active } = useTouchable();
const router = useRouter();
const { bind: _bind, hover, active } = useTouchable();
const router = useRouter();
const link = `#${id}`;
const link = `#${id}`;
const handleLinkClick = () => {
void router.push(router.pathname, router.pathname + link, { shallow: true });
doChangeActiveSlug(id);
};
const styles = getHeadingStyles(as as any);
const handleLinkClick = () => {
void router.push(router.pathname, router.pathname + link, { shallow: true });
doChangeActiveSlug(id);
};
const styles = getHeadingStyles(as as any);
const bind = id ? _bind : {};
const bind = id ? _bind : {};
return (
<Title
as={as}
{...bind}
css={css({
...baseTypeStyles,
...styles,
color: isActive ? color('accent') : (color('text-title') as any),
// @ts-ignore
alignItems: 'center',
// @ts-ignore
position: 'relative',
// @ts-ignore
display: 'flex',
// @ts-ignore
justifyContent: 'flex-start',
// @ts-ignore
cursor: id && hover ? 'pointer' : 'unset',
...rest,
})}
>
<Box as="span">{children}</Box>
<AnchorOffset id={id} />
{id && isActive && <Hashtag />}
{id && <LinkButton opacity={hover ? 1 : 0} link={link} />}
</Title>
);
};
return (
<Title
as={as}
{...bind}
{...{
...baseTypeStyles,
...styles,
color: isActive ? color('accent') : (color('text-title') as any),
alignItems: 'center',
position: 'relative',
display: 'flex',
justifyContent: 'flex-start',
cursor: id && hover ? 'pointer' : 'unset',
}}
{...rest}
>
<Box as="span">{children}</Box>
<AnchorOffset id={id} />
{id && isActive && <Hashtag />}
{id && <LinkButton opacity={hover ? 1 : 0} link={link} />}
</Title>
);
}
);
export const BaseHeading: React.FC<BoxProps> = React.memo(props => (
<Heading width="100%" mt={space('base-loose')} {...props} />
export const BaseHeading: React.FC<BoxProps> = React.memo(({ ...props }) => (
<Heading width="100%" mt={space('base-loose')} {...(props as any)} />
));

43
src/components/mdx/components/link.tsx

@ -1,11 +1,11 @@
import { Box, BoxProps, color, space, Fade } from '@blockstack/ui';
import { Box, BoxProps, color, space, Fade } from '@stacks/ui';
import NextLink from 'next/link';
import React, { forwardRef, Ref } from 'react';
import { useAppState } from '@common/hooks/use-app-state';
import { border, transition } from '@common/utils';
import { Text } from '@components/typography';
import { useTouchable } from '@common/hooks/use-touchable';
import { css } from '@styled-system/css';
import { css, forwardRefWithAs } from '@stacks/ui-core';
import { getHeadingStyles } from '@components/mdx/typography';
import { PageMeta } from '@components/page-meta';
@ -58,10 +58,10 @@ const Card = ({ route, styles, ...rest }) => {
>
<Box as="span" display="block" bg={color('bg-light')} p={space('base')}>
<Text
css={css({
{...{
...getHeadingStyles('h5'),
display: 'block',
})}
}}
>
{description}
</Text>
@ -120,23 +120,18 @@ export const LinkWithHover = forwardRef(
}
);
export const Link = forwardRef(
(
props: { href?: string; target?: string; rel?: string } & BoxProps,
ref: Ref<HTMLDivElement>
) => {
return (
<Box
as={props.href ? 'a' : 'span'}
ref={ref}
color="var(--colors-accent)"
cursor="pointer"
textDecoration="underline"
_hover={{ textDecoration: 'none' }}
_focus={{ boxShadow: 'outline' }}
rel="nofollow noopener noreferrer"
{...props}
/>
);
}
);
export const Link = forwardRefWithAs<BoxProps, 'a'>((props, ref) => {
return (
<Box
as={props.href ? 'a' : 'span'}
ref={ref}
color="var(--colors-accent)"
cursor="pointer"
textDecoration="none"
_hover={{ textDecoration: 'underline' }}
_focus={{ boxShadow: 'outline' }}
rel="nofollow noopener noreferrer"
{...props}
/>
);
});

2
src/components/mdx/components/list.tsx

@ -1,4 +1,4 @@
import { Box, BoxProps, color, space } from '@blockstack/ui';
import { Box, BoxProps, color, space } from '@stacks/ui';
import React, { forwardRef, Ref } from 'react';
export const Ol: React.FC<BoxProps> = props => (

2
src/components/mdx/components/section.tsx

@ -1,5 +1,5 @@
import React from 'react';
import { Box, BoxProps } from '@blockstack/ui';
import { Box, BoxProps } from '@stacks/ui';
export const Section: React.FC<BoxProps> = React.memo(
React.forwardRef(({ children, ...rest }, ref) => {

2
src/components/mdx/components/table.tsx

@ -1,4 +1,4 @@
import { Box, color, space } from '@blockstack/ui';
import { Box, color, space } from '@stacks/ui';
import React from 'react';
import { P } from '@components/mdx/components';
import { border } from '@common/utils';

49
src/components/mdx/components/typography.tsx

@ -1,21 +1,44 @@
import { Box, BoxProps, color, space } from '@blockstack/ui';
import { Box, BoxProps, color, space } from '@stacks/ui';
import React from 'react';
import { Text } from '@components/typography';
import { BaseHeading } from '@components/mdx/components/heading';
import { forwardRefWithAs, ForwardRefExoticComponentWithAs } from '@stacks/ui-core';
export const H1: React.FC<BoxProps> = props => <BaseHeading as="h1" {...props} />;
export const H2: React.FC<BoxProps> = props => <BaseHeading as="h2" {...props} />;
export const H3: React.FC<BoxProps> = props => <BaseHeading as="h3" {...props} />;
export const H4: React.FC<BoxProps> = props => <BaseHeading as="h4" {...props} />;
export const H5: React.FC<BoxProps> = props => <BaseHeading as="h5" {...props} />;
export const H6: React.FC<BoxProps> = props => <BaseHeading as="h6" {...props} />;
export const H1: ForwardRefExoticComponentWithAs<BoxProps, 'h1'> = forwardRefWithAs<BoxProps, 'h1'>(
(props, ref) => <BaseHeading as="h1" ref={ref} {...props} />
);
export const H2: ForwardRefExoticComponentWithAs<BoxProps, 'h2'> = forwardRefWithAs<BoxProps, 'h2'>(
(props, ref) => <BaseHeading as="h2" ref={ref} {...props} />
);
export const H3: ForwardRefExoticComponentWithAs<BoxProps, 'h3'> = forwardRefWithAs<BoxProps, 'h3'>(
(props, ref) => <BaseHeading as="h3" ref={ref} {...props} />
);
export const H4: ForwardRefExoticComponentWithAs<BoxProps, 'h4'> = forwardRefWithAs<BoxProps, 'h4'>(
(props, ref) => <BaseHeading as="h4" ref={ref} {...props} />
);
export const H5: ForwardRefExoticComponentWithAs<BoxProps, 'h5'> = forwardRefWithAs<BoxProps, 'h5'>(
(props, ref) => <BaseHeading as="h5" ref={ref} {...props} />
);
export const H6: ForwardRefExoticComponentWithAs<BoxProps, 'h6'> = forwardRefWithAs<BoxProps, 'h6'>(
(props, ref) => <BaseHeading as="h6" ref={ref} {...props} />
);
export const Br: React.FC<BoxProps> = props => <Box height="24px" {...props} />;
export const Hr: React.FC<BoxProps> = props => (
<Box as="hr" borderTopWidth="1px" borderColor={color('border')} my={'64px'} {...props} />
export const Br: ForwardRefExoticComponentWithAs<BoxProps, 'br'> = forwardRefWithAs<BoxProps, 'br'>(
props => <Box height="24px" {...props} />
);
export const Hr: ForwardRefExoticComponentWithAs<BoxProps, 'hr'> = forwardRefWithAs<BoxProps, 'hr'>(
props => <Box as="hr" borderTopWidth="1px" borderColor={color('border')} my={'64px'} {...props} />
);
export const P: React.FC<BoxProps> = props => <Text as="p" {...props} />;
export const P: ForwardRefExoticComponentWithAs<BoxProps, 'p'> = forwardRefWithAs<BoxProps, 'p'>(
(props, ref) => <Text as="p" ref={ref} {...props} />
);
export const Pre = (props: any) => <Text as="pre" {...props} />;
export const Sup: React.FC<any> = props => <Text as="sup" mr={space('extra-tight')} {...props} />;
export const Pre: ForwardRefExoticComponentWithAs<BoxProps, 'pre'> = forwardRefWithAs<
BoxProps,
'pre'
>((props, ref) => <Text as="pre" ref={ref} {...props} />);
export const Sup: ForwardRefExoticComponentWithAs<BoxProps, 'sup'> = forwardRefWithAs<
BoxProps,
'sup'
>((props, ref) => <Text as="sup" ref={ref} mr={space('extra-tight')} {...props} />);

52
src/components/mdx/image.tsx

@ -1,6 +1,7 @@
import React from 'react';
import { Box, BoxProps } from '@blockstack/ui';
import { Box, BoxProps } from '@stacks/ui';
import { useRouter } from 'next/router';
import { ForwardRefExoticComponentWithAs, forwardRefWithAs } from '@stacks/ui-core';
const imgix = 'https://stacks-documentation.imgix.net';
@ -18,7 +19,7 @@ const getUrl = pathname => {
};
const useImgix = (src: string) => {
if (process.env.NODE_ENV !== 'production' || !src)
if (process.env.NEXT_PUBLIC_STAGING || process.env.NODE_ENV !== 'production' || !src)
return {
src,
srcset: undefined,
@ -56,30 +57,29 @@ const getAspectRatio = dimensions => {
return (height / width) * 100;
};
const BaseImg: React.FC<
BoxProps & {
src?: string;
srcSet?: string;
loading?: string;
const BaseImg: ForwardRefExoticComponentWithAs<BoxProps, 'img'> = forwardRefWithAs<BoxProps, 'img'>(
({ as = 'img', style = {}, ...props }, ref) => {
return (
<Box
maxWidth="100%"
width={['100%', '100%', 'inherit', 'inherit']}
display="block"
as={as}
loading="lazy"
imageRendering="-webkit-optimize-contrast"
style={{
...style,
}}
ref={ref}
{...props}
/>
);
}
> = ({ style = {}, ...props }) => {
return (
<Box
maxWidth="100%"
width={['100%', '100%', 'inherit', 'inherit']}
display="block"
loading="lazy"
as="img"
style={{
...style,
}}
{...props}
/>
);
};
);
export const Img: React.FC<
BoxProps & { loading?: string; src?: string; alt?: string; dimensions?: any }
export const Img: ForwardRefExoticComponentWithAs<
BoxProps & { loading?: string; dimensions?: any },
'img'
> = React.memo(({ src: _src, dimensions, ...rest }) => {
const { src, srcset } = useImgix(_src);
@ -99,9 +99,9 @@ export const Img: React.FC<
return (
<Box width={width} maxWidth="100%" padding="0 !important" position="relative" className="img">
<Box height="0" paddingBottom={`${aspectRatio}%`} width="100%" />
<BaseImg position="absolute" top={0} left={0} {...props} />
<BaseImg position="absolute" top={0} left={0} {...(props as any)} />
</Box>
);
}
return <BaseImg className="img" {...props} />;
return <BaseImg className="img" {...(props as any)} />;
});

26
src/components/mdx/md-contents.tsx

@ -1,8 +1,7 @@
import React from 'react';
import { Box, space, themeColor, color } from '@blockstack/ui';
import { Box, space, themeColor, color } from '@stacks/ui';
import { ContentWrapper } from '../content-wrapper';
import { TableOfContents } from '@components/toc';
import { css } from '@styled-system/css';
import { TOC_WIDTH } from '@common/constants';
import { useRouter } from 'next/router';
import dynamic from 'next/dynamic';
@ -11,7 +10,8 @@ import { border } from '@common/utils';
import { getCapsizeStyles } from '@components/mdx/typography';
import { MDXProvider } from '@mdx-js/react';
import { MDXComponents } from '@components/mdx';
export const styleOverwrites = {
import { css, ThemeUICSSObject } from '@stacks/ui-core';
export const styleOverwrites: ThemeUICSSObject = {
'& > section': {
'&:nth-child(2)': {
'& > *:first-child, & > section:first-child > *:first-child': {
@ -75,7 +75,7 @@ export const styleOverwrites = {
'p, li': {
overflowWrap: 'break-word',
display: 'inline-block',
...getCapsizeStyles(16, 26),
...getCapsizeStyles(16, 26, ':'),
},
li: {
'& > p': {
@ -129,7 +129,7 @@ export const styleOverwrites = {
h2: {
mt: '64px',
'&, & > *': {
...getHeadingStyles('h2'),
...getHeadingStyles('h2', ':'),
},
'& > code': {
px: space('tight'),
@ -144,7 +144,7 @@ export const styleOverwrites = {
h3: {
mt: '64px',
'&, & > *': {
...getHeadingStyles('h3'),
...getHeadingStyles('h3', ':'),
},
'& + section > h4': {
mt: 0,
@ -153,7 +153,7 @@ export const styleOverwrites = {
h4: {
mt: '64px',
'&, & > *': {
...getHeadingStyles('h4'),
...getHeadingStyles('h4', ':'),
},
'& + section > h5': {
mt: 0,
@ -162,19 +162,19 @@ export const styleOverwrites = {
h5: {
mt: space('extra-loose'),
'&, & > *': {
...getHeadingStyles('h5'),
...getHeadingStyles('h5', ':'),
},
},
h6: {
mt: space('extra-loose'),
'&, & > *': {
...getHeadingStyles('h6'),
...getHeadingStyles('h6', ':'),
},
},
h1: {
mt: space('extra-loose'),
'&, & > *': {
...getHeadingStyles('h1'),
...getHeadingStyles('h1', ':'),
},
'& + *': {
mt: space('extra-loose'),
@ -251,9 +251,9 @@ export const MDContents: React.FC<any> = ({ pageTop: PageTop = null, headings, c
<>
<ContentWrapper
width={['100%', '100%', '100%', `calc(100% - ${isHome ? 0 : TOC_WIDTH}px)`]}
mx="unset"
pt="unset"
css={css(styleOverwrites as any)}
mx="0"
pt="0"
css={theme => css(styleOverwrites)(theme)}
pr={!isHome && ['0', '0', '0', 'extra-loose']}
>
{PageTop && <PageTop />}

220
src/components/mdx/overrides.tsx

@ -1,103 +1,125 @@
import React from 'react';
import { color } from '@blockstack/ui';
import { createGlobalStyle } from 'styled-components';
import { color } from '@stacks/ui';
import { css, Global } from '@emotion/react';
const GlobalStyles = createGlobalStyle`
:root {
--reach-tooltip: 1;
}
const GlobalStyles = (
<Global
styles={css`
blockquote,
dl,
dd,
h1,
h2,
h3,
h4,
h5,
h6,
hr,
figure,
p,
pre {
margin: 0px;
}
:root {
--reach-tooltip: 1;
}
a {
text-decoration: none;
}
* {
font-feature-settings: 'onum' 1, 'pnum' 1, 'kern' 1, 'ss01' 1;
}
html,
body {
font-family: 'Soehne', Inter, sans-serif;
}
@counter-style list {
pad: '0';
}
img {
image-rendering: crisp-edges;
will-change: transform;
}
:root {
--docsearch-modal-background: ${color('bg')};
--docsearch-text-color: ${color('text-title')};
--docsearch-icon-color: ${color('text-caption')};
--docsearch-primary-color: ${color('accent')};
--docsearch-input-color: ${color('text-title')};
--docsearch-highlight-color: ${color('bg-alt')};
--docsearch-placeholder-color: ${color('text-caption')};
--docsearch-container-background: rgba(22, 22, 22, 0.75);
--docsearch-modal-shadow: inset 0px 0px 1px 1px ${color('border')};
--docsearch-searchbox-background: var(--ifm-color-emphasis-300);
--docsearch-searchbox-focus-background: ${color('bg')};
--docsearch-searchbox-shadow: inset 0px 0px 1px 1px ${color('border')};
--docsearch-hit-color: var(--ifm-color-emphasis-800);
--docsearch-hit-active-color: ${color('text-title')};
--docsearch-hit-background: ${color('bg')};
--docsearch-hit-shadow: inset 0px 0px 1px 1px ${color('border')};
--docsearch-key-gradient: transparent;
--docsearch-key-shadow: inset 0px -2px 0px 0px transparent,
inset 0px 0px 1px 1px transparent, 0px 1px 2px 1px transparent;
--docsearch-footer-background: ${color('bg')};
--docsearch-footer-shadow: inset 0px 0px 1px 1px ${color('border')};
--docsearch-logo-color: #5468ff;
--docsearch-muted-color: #969faf;
--docsearch-modal-width: 560px;
--docsearch-modal-height: 600px;
--docsearch-searchbox-height: 56px;
--docsearch-hit-height: 56px;
--docsearch-footer-height: 44px;
--docsearch-spacing: 12px;
--docsearch-icon-stroke-width: 1.4;
}
.DocSearch-Container {
z-index: 99999;
}
.DocSearch-SearchBar {
padding: var(--docsearch-spacing);
}
.DocSearch-Reset:hover {
color: ${color('accent')};
}
.DocSearch-Form {
input {
color: ${color('text-title')};
}
&:focus-within {
box-shadow: 0 0 0 3px rgba(170, 179, 255, 0.75);
}
}
.DocSearch-Help {
text-align: center;
}
.DocSearch-Prefill {
color: ${color('accent')} !important;
}
.DocSearch-Hit {
mark {
color: ${color('accent')} !important;
}
}
.DocSearch-Hit-source {
color: ${color('text-caption')};
}
.DocSearch-MagnifierLabel {
color: ${color('accent')};
}
* {
font-feature-settings: "onum" 1, "pnum" 1, "kern" 1, "ss01" 1;
}
html, body {
font-family: 'Soehne', Inter, sans-serif;
}
@counter-style list {
pad: "0";
}
img{
image-rendering: crisp-edges;
will-change: transform;
}
:root{
--docsearch-modal-background: ${color('bg')};
--docsearch-text-color: ${color('text-title')};
--docsearch-icon-color: ${color('text-caption')};
--docsearch-primary-color: ${color('accent')};
--docsearch-input-color: ${color('text-title')};
--docsearch-highlight-color: ${color('bg-alt')};
--docsearch-placeholder-color: ${color('text-caption')};
--docsearch-container-background: rgba(22,22,22,0.75);
--docsearch-modal-shadow: inset 0px 0px 1px 1px ${color('border')};
--docsearch-searchbox-background: var(--ifm-color-emphasis-300);
--docsearch-searchbox-focus-background: ${color('bg')};;
--docsearch-searchbox-shadow: inset 0px 0px 1px 1px ${color('border')};
--docsearch-hit-color: var(--ifm-color-emphasis-800);
--docsearch-hit-active-color: ${color('text-title')};
--docsearch-hit-background: ${color('bg')};
--docsearch-hit-shadow: inset 0px 0px 1px 1px ${color('border')};
--docsearch-key-gradient: transparent;
--docsearch-key-shadow: inset 0px -2px 0px 0px transparent,inset 0px 0px 1px 1px transparent,0px 1px 2px 1px transparent;
--docsearch-footer-background: ${color('bg')};
--docsearch-footer-shadow: inset 0px 0px 1px 1px ${color('border')};
--docsearch-logo-color: #5468ff;
--docsearch-muted-color: #969faf;
--docsearch-modal-width: 560px;
--docsearch-modal-height: 600px;
--docsearch-searchbox-height: 56px;
--docsearch-hit-height: 56px;
--docsearch-footer-height: 44px;
--docsearch-spacing: 12px;
--docsearch-icon-stroke-width: 1.4;
}
.DocSearch-Container{
z-index: 99999;
}
.DocSearch-SearchBar{
padding: var(--docsearch-spacing);
}
.DocSearch-Reset:hover{
color: ${color('accent')};
}
.DocSearch-Form{
input{
color: ${color('text-title')};
}
&:focus-within{
box-shadow: 0 0 0 3px rgba(170, 179, 255, 0.75);
}
}
.DocSearch-Help{
text-align: center;
}
.DocSearch-Prefill{
color: ${color('accent')} !important;
}
.DocSearch-Hit{
mark{
color: ${color('accent')} !important;
}
}
.DocSearch-Hit-source{
color: ${color('text-caption')};
}
.DocSearch-MagnifierLabel{
color: ${color('accent')};
}
pre{
display: inline-block;
}
p, ul, ol, table {
color: ${color('text-body')};
a > pre {
color: ${color('accent')} !important;
}
}
`;
export const MdxOverrides: React.FC<any> = props => (
<>
<GlobalStyles />
</>
pre {
display: inline-block;
}
p,
ul,
ol,
table {
color: ${color('text-body')};
a > pre {
color: ${color('accent')} !important;
}
}
`}
/>
);
export const MdxOverrides = GlobalStyles;

2
src/components/mdx/styles.tsx

@ -1,5 +1,5 @@
import React from 'react';
import { color, space, themeColor } from '@blockstack/ui';
import { color, space, themeColor } from '@stacks/ui';
import { getHeadingStyles } from '@components/mdx/typography';
import { border } from '@common/utils';
import { getCapsizeStyles } from '@components/mdx/typography';

70
src/components/mdx/typography.ts

@ -14,54 +14,64 @@ export const baseTypeStyles = {
fontFamily: `'Soehne', Inter, sans-serif`,
};
export const getCapsizeStyles = (fontSize, leading) =>
capsize({
export const getCapsizeStyles = (fontSize, leading, prefix = '_') => {
const styles = capsize({
fontMetrics,
fontSize,
leading,
});
const h1 = {
fontWeight: 600,
...getCapsizeStyles(36, 42),
Object.keys(styles).forEach(prop => {
if (prop.startsWith('::')) {
styles[prop.replace('::', prefix)] = styles[prop];
delete styles[prop];
}
});
return styles;
};
const h2 = {
const h1 = prefix => ({
fontWeight: 600,
...getCapsizeStyles(36, 42, prefix),
});
const h2 = prefix => ({
fontWeight: 500,
...getCapsizeStyles(24, 32),
};
...getCapsizeStyles(24, 32, prefix),
});
const h3 = {
const h3 = prefix => ({
fontWeight: 500,
...getCapsizeStyles(18, 28),
};
...getCapsizeStyles(18, 28, prefix),
});
const h4 = {
const h4 = prefix => ({
fontWeight: 400,
...getCapsizeStyles(20, 32),
};
...getCapsizeStyles(20, 32, prefix),
});
const h5 = {
const h5 = prefix => ({
fontWeight: 400,
...getCapsizeStyles(16, 26),
};
...getCapsizeStyles(16, 26, prefix),
});
const h6 = {
const h6 = prefix => ({
fontWeight: 400,
...getCapsizeStyles(14, 20),
};
...getCapsizeStyles(14, 20, prefix),
});
const headings = {
h1,
h2,
h3,
h4,
h5,
h6,
};
const headings = (as, prefix) => ({
h1: h1(prefix),
h2: h2(prefix),
h3: h3(prefix),
h4: h4(prefix),
h5: h5(prefix),
h6: h6(prefix),
});
export const getHeadingStyles = (as: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6') => {
export const getHeadingStyles = (as: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6', prefix = '_') => {
return {
...headings[as],
...headings(as, prefix)[as],
};
};

4
src/components/mobile-menu.tsx

@ -1,5 +1,5 @@
import React from 'react';
import { Flex, Box, FlexProps, color, space, CloseIcon, Fade, Transition } from '@blockstack/ui';
import { Flex, Box, FlexProps, color, space, CloseIcon, Fade, Transition } from '@stacks/ui';
import { SideNav } from '@components/side-nav';
import { useLockBodyScroll } from '@common/hooks/use-lock-body-scroll';
import { useMobileMenuState } from '@common/hooks/use-mobile-menu';
@ -68,7 +68,7 @@ export const MobileMenu: React.FC<FlexProps> = props => {
borderLeft={border()}
>
<Flex
align="center"
alignItems="center"
justifyContent="flex-end"
height="72px"
px={space(['extra-loose', 'extra-loose', 'base', 'base'])}

26
src/components/page-meta.tsx

@ -1,45 +1,33 @@
import React from 'react';
import { Box, Flex, space, Stack, BoxProps, color, StackProps } from '@blockstack/ui';
import { Box, Flex, space, Stack, BoxProps, color, StackProps, FlexProps } from '@stacks/ui';
import { Text } from '@components/typography';
import { ToolsIcon } from '@components/icons/tools';
import { ClockIcon } from '@components/icons/clock';
import { css } from '@styled-system/css';
import { getCapsizeStyles } from '@components/mdx/typography';
const Experience: React.FC<
BoxProps & { level?: 'beginner' | 'intermediate' | 'advanced'; small?: boolean }
FlexProps & { level?: 'beginner' | 'intermediate' | 'advanced'; small?: boolean }
> = ({ level, small, ...rest }) => (
<Flex align="center" {...rest}>
<Flex alignItems="center" {...rest}>
<Box mr={space('extra-tight')} color={color('text-caption')}>
<ToolsIcon size={small ? '16px' : '20px'} />
</Box>
<Text
textTransform="capitalize"
css={css({
...getCapsizeStyles(small ? 14 : 16, 16),
})}
>
<Text textTransform="capitalize" {...getCapsizeStyles(small ? 14 : 16, 16)}>
{level}
</Text>
</Flex>
);
const Duration: React.FC<BoxProps & { value?: string; small?: boolean }> = ({
const Duration: React.FC<FlexProps & { value?: string; small?: boolean }> = ({
value,
small,
...rest
}) => (
<Flex align="center" {...rest}>
<Flex alignItems="center" {...rest}>
<Box mr={space('extra-tight')} color={color('text-caption')}>
<ClockIcon size={small ? '16px' : '20px'} />
</Box>
<Text
css={css({
...getCapsizeStyles(small ? 14 : 16, 16),
})}
>
{value}
</Text>
<Text {...getCapsizeStyles(small ? 14 : 16, 16)}>{value}</Text>
</Flex>
);

12
src/components/page-top.tsx

@ -1,11 +1,11 @@
import React from 'react';
import { Box, Flex, Stack, space, BoxProps } from '@blockstack/ui';
import { Box, Flex, Stack, space, BoxProps } from '@stacks/ui';
import { H1 } from '@components/mdx';
import { Text } from '@components/typography';
import { useRouter } from 'next/router';
import dynamic from 'next/dynamic';
import { getTitle } from '@common/utils';
import { css } from '@styled-system/css';
import { css } from '@stacks/ui-core';
import { getHeadingStyles } from '@components/mdx/typography';
const Search = dynamic(() => import('@components/search'));
import { PageMeta } from '@components/page-meta';
@ -38,13 +38,7 @@ export const PageTop: React.FC<PageTopProps> = React.memo(
</Flex>
{description ? (
<Box mt="40px !important">
<Text
css={css({
...getHeadingStyles('h4'),
})}
>
{description}
</Text>
<Text {...getHeadingStyles('h4')}>{description}</Text>
</Box>
) : null}
<PageMeta duration={duration} experience={experience} isHome={isHome} />

18
src/components/pagination.tsx

@ -1,5 +1,5 @@
import React from 'react';
import { Box, BoxProps, Flex, Grid, color, space, transition } from '@blockstack/ui';
import { Box, BoxProps, Flex, Grid, color, space, transition } from '@stacks/ui';
import { useAppState } from '@common/hooks/use-app-state';
import { useRouter } from 'next/router';
import { border, getTitle } from '@common/utils';
@ -7,7 +7,7 @@ import NextLink from 'next/link';
import { Caption, Text, Link } from '@components/typography';
import { useTouchable } from '@common/hooks/use-touchable';
import { getHeadingStyles } from '@components/mdx/typography';
import { css } from '@styled-system/css';
import { css } from '@stacks/ui-core';
import { ArrowRightIcon } from '@components/icons/arrow-right';
import { ArrowLeftIcon } from '@components/icons/arrow-left';
@ -82,9 +82,7 @@ const Pretitle: React.FC<BoxProps> = props => (
display="block"
color={color('text-caption')}
transition={transition}
css={css({
...getHeadingStyles('h6'),
})}
{...getHeadingStyles('h6')}
{...props}
/>
);
@ -97,9 +95,7 @@ const Title: React.FC<BoxProps & { isHovered?: boolean }> = ({ isHovered, ...pro
transition={transition}
color={isHovered ? color('accent') : color('text-title')}
mb={space('tight')}
css={css({
...getHeadingStyles('h4'),
})}
{...getHeadingStyles('h4')}
{...props}
/>
);
@ -112,7 +108,7 @@ const PrevCard: React.FC<any> = React.memo(props => {
{({ hover, active }) => (
<>
<FloatingLink href={prev.path} />
<Flex position="relative" mb={space('base-tight')} align="center">
<Flex position="relative" mb={space('base-tight')} alignItems="center">
<Pretitle
left={hover || active ? '18px' : 0}
bg={color('bg')}
@ -137,11 +133,11 @@ const NextCard: React.FC<any> = React.memo(props => {
const { next } = usePaginateRoutes();
return next ? (
<Card py="loose" textAlign="right" align="flex-end">
<Card py="loose" textAlign="right" alignItems="flex-end">
{({ hover, active }) => (
<>
<FloatingLink href={next.path} />
<Flex position="relative" mb={space('base-tight')} align="center">
<Flex position="relative" mb={space('base-tight')} alignItems="center">
<Pretitle
right={hover || active ? '18px' : 0}
bg={color('bg')}

15
src/components/progress-bar.tsx

@ -1,7 +1,7 @@
import * as React from 'react';
import Router from 'next/router';
import NProgress from 'nprogress';
import { createGlobalStyle, css } from 'styled-components';
import { css, Global } from '@emotion/react';
import debounce from 'lodash.debounce';
const styles = css`
@ -59,9 +59,10 @@ const styles = css`
}
}
`;
const ProgressBarStyles = createGlobalStyle`${styles}`;
export const ProgressBarStyles = <Global styles={styles} />;
export const useProgressBar = () => {
// eslint-disable-next-line @typescript-eslint/unbound-method
const { start, done } = NProgress;
return {
@ -70,7 +71,7 @@ export const useProgressBar = () => {
};
};
export const ProgressBar = () => {
export const ProgressBar = React.memo(() => {
// eslint-disable-next-line @typescript-eslint/unbound-method
const start = debounce(NProgress.start, 450);
React.useEffect(() => {
@ -86,9 +87,5 @@ export const ProgressBar = () => {
NProgress.done();
});
}, []);
return (
<>
<ProgressBarStyles />
</>
);
};
return <></>;
});

16
src/components/search.tsx

@ -10,14 +10,14 @@ import {
BoxProps,
Grid,
Stack,
} from '@blockstack/ui';
} from '@stacks/ui';
import { useDocSearchKeyboardEvents } from '@docsearch/react';
import { Text } from '@components/typography';
import { SearchIcon } from '@components/icons/search';
import Router from 'next/router';
import Link from 'next/link';
import { getCapsizeStyles } from '@components/mdx/typography';
import { css } from '@styled-system/css';
import { css } from '@stacks/ui-core';
import { border } from '@common/utils';
const getLocalUrl = href => {
@ -58,12 +58,12 @@ const Key: React.FC<BoxProps> = React.memo(({ children, ...rest }) => (
{...rest}
>
<Text
css={css({
{...{
color: color('text-body'),
display: 'block',
transform: 'translateY(1px)',
...getCapsizeStyles(12, 12),
})}
}}
>
{children}
</Text>
@ -148,13 +148,13 @@ export const SearchBox: React.FC<BoxProps> = React.memo(props => {
}}
{...props}
>
<Flex align="center" justifyContent="space-between">
<Flex alignItems="center" justifyContent="space-between">
<Flex
ref={searchButtonRef}
onClick={onOpen}
px={space('base-tight')}
py={space('tight')}
align="center"
alignItems="center"
_hover={{ borderColor: themeColor('blue.400') }}
>
<Box
@ -167,10 +167,10 @@ export const SearchBox: React.FC<BoxProps> = React.memo(props => {
</Box>
<Text
opacity={0.8}
css={css({
{...{
color: color('text-caption'),
...getCapsizeStyles(14, 28),
})}
}}
>
Search docs
</Text>

39
src/components/side-nav.tsx

@ -1,5 +1,5 @@
import React from 'react';
import { Flex, Box, color, space, BoxProps } from '@blockstack/ui';
import { Flex, Box, color, space, BoxProps } from '@stacks/ui';
import Link from 'next/link';
import { useAppState } from '@common/hooks/use-app-state';
import { SIDEBAR_WIDTH } from '@common/constants';
@ -10,9 +10,10 @@ import { getCategory, getTitle, slugify } from '@common/utils';
import { useRouter } from 'next/router';
import { getCapsizeStyles } from '@components/mdx/typography';
import { Text } from '@components/typography';
import { css } from '@styled-system/css';
import { css } from '@stacks/ui-core';
import { SmartLink } from '@components/mdx';
import { useMobileMenuState } from '@common/hooks/use-mobile-menu';
import { useTheme } from '@emotion/react';
const Wrapper: React.FC<BoxProps & { containerProps?: BoxProps }> = ({
width = `${SIDEBAR_WIDTH}px`,
@ -58,23 +59,19 @@ const PageItem = React.forwardRef(
ref: any
) => {
const typeStyles = isTopLevel ? getCapsizeStyles(16, 26) : getCapsizeStyles(14, 20);
const styleProps = {
outline: '0',
display: 'block',
color: isActive ? color('accent') : isTopLevel ? color('text-title') : _color,
mb: isTopLevel ? space('base-loose') : mb,
};
return (
<SmartLink
ref={ref}
css={css({
outline: '0',
display: 'block',
...typeStyles,
color: isActive ? color('accent') : isTopLevel ? color('text-title') : _color,
mb: isTopLevel ? space('base-loose') : mb,
':hover': {
color: isTopLevel ? color('accent') : color('text-title'),
},
textDecoration: 'none',
':focus': {
color: color('accent'),
},
})}
{...styleProps}
_hover={{ color: isTopLevel ? color('accent') : color('text-title') }}
_focus={{ color: color('accent') }}
{...typeStyles}
{...props}
>
{children}
@ -85,12 +82,12 @@ const PageItem = React.forwardRef(
const SectionTitle: React.FC<BoxProps> = ({ children, ...rest }) => (
<Text
css={css({
{...{
display: 'block',
...getCapsizeStyles(16, 26),
color: color('text-title'),
...rest,
})}
}}
>
{children}
</Text>
@ -156,7 +153,7 @@ const ChildPages = ({ items, handleClick }: any) => {
};
const ChildSection: React.FC<BoxProps & { sections?: any }> = ({ sections, ...rest }) =>
sections.map((section, key) => {
sections?.map((section, key) => {
return (
<Box {...rest} key={key}>
<SectionTitle
@ -180,7 +177,7 @@ const BackItem = props => (
cursor: 'pointer',
color: color('text-title'),
}}
align="center"
alignItems="center"
{...props}
>
<Box mr={space('extra-tight')}>
@ -289,7 +286,7 @@ const Navigation = () => {
return (
<Box mb="40px" key={i}>
{section.title ? (
<Flex width="100%" align="center" mb={space('loose')}>
<Flex width="100%" alignItems="center" mb={space('loose')}>
<SectionTitle>{section.title}</SectionTitle>
</Flex>
) : null}

12
src/components/status-check.tsx

@ -1,14 +1,14 @@
import React from 'react';
import useSWR from 'swr';
import { Box, Flex, space, color, BoxProps } from '@blockstack/ui';
import { Box, Flex, space, color, BoxProps } from '@stacks/ui';
import { border, transition } from '@common/utils';
import { Link } from '@components/mdx';
import { LinkProps, Text } from '@components/typography';
import { Spinner } from '@blockstack/ui';
import { Spinner } from '@stacks/ui';
import { CircleCheck } from '@components/icons/circle-check';
import { AlertCircleIcon } from '@components/icons/alert-circle';
import { STATUS_CHECKER_URL } from '@common/constants';
import { css } from '@styled-system/css';
import { css } from '@stacks/ui-core';
import { getCapsizeStyles } from '@components/mdx/typography';
const fetcher = url => fetch(url).then(r => r.json());
@ -69,7 +69,7 @@ export const StatusCheck: React.FC<LinkProps> = props => {
transition={transition()}
{...props}
>
<Flex align="center">
<Flex alignItems="center">
<Box mr={space('tight')}>
{!data && !error ? (
<Box
@ -88,10 +88,10 @@ export const StatusCheck: React.FC<LinkProps> = props => {
)}
</Box>
<Text
css={css({
{...{
color: 'currentColor',
...getCapsizeStyles(14, 24),
})}
}}
>
Stacks 2.0 testnet status
<StatusWords status={status} />

9
src/components/toc.tsx

@ -1,12 +1,11 @@
import React from 'react';
import { Box, Grid, color, space, BoxProps } from '@blockstack/ui';
import { Box, Grid, color, space, BoxProps } from '@stacks/ui';
import { slugify } from '@common/utils';
import { Text } from '@components/typography';
import { Link } from '@components/mdx';
import { useActiveHeading } from '@common/hooks/use-active-heading';
import NextLink from 'next/link';
import { getHeadingStyles } from '@components/mdx/typography';
import { css } from '@styled-system/css';
const getLevelPadding = (level: number) => {
switch (level) {
@ -82,10 +81,10 @@ export const TableOfContents = ({
{!noLabel && (
<Box mb={space('base')}>
<Text
css={css({
{...{
...getHeadingStyles('h6'),
fontWeight: 500,
})}
}}
>
{label}
</Text>
@ -95,7 +94,7 @@ export const TableOfContents = ({
gridColumnGap={space('base-loose')}
gridTemplateColumns={
Array.isArray(columns)
? columns.map(value => `repeat(${value}, 1fr)`)
? (columns as any).map(value => `repeat(${value}, 1fr)`)
: `repeat(${columns}, 1fr)`
}
>

2
src/components/tooltip.tsx

@ -1,5 +1,5 @@
import * as React from 'react';
import { color } from '@blockstack/ui';
import { color } from '@stacks/ui';
import { useTooltip, TooltipPopup } from '@reach/tooltip';
const centered = (triggerRect: any, tooltipRect: any) => {

49
src/components/typography.tsx

@ -1,36 +1,47 @@
import * as React from 'react';
import { Text as BaseText, BoxProps, color } from '@blockstack/ui';
import { Box, BoxProps, color } from '@stacks/ui';
import { getCapsizeStyles } from '@components/mdx/typography';
import { forwardRefWithAs, ForwardRefExoticComponentWithAs } from '@stacks/ui-core';
export const Text = React.forwardRef((props: BoxProps, ref) => (
<BaseText ref={ref} color={color('text-body')} {...getCapsizeStyles(16, 26)} {...props} />
));
export const Text: ForwardRefExoticComponentWithAs<BoxProps, 'span'> = forwardRefWithAs<
BoxProps,
'span'
>((props, ref) => <Box as="span" ref={ref} color={color('text-body')} {...props} />);
export const Caption: React.FC<BoxProps> = props => (
export const Caption: ForwardRefExoticComponentWithAs<
BoxProps,
'span'
> = forwardRefWithAs((props, ref) => (
<Text
style={{ userSelect: 'none' }}
color={color('text-caption')}
display="inline-block"
ref={ref}
{...getCapsizeStyles(14, 22)}
{...props}
/>
);
));
export const Title: React.FC<BoxProps> = React.forwardRef((props, ref) => (
export const Title: ForwardRefExoticComponentWithAs<
BoxProps,
'span'
> = React.forwardRef((props, ref) => (
<Text ref={ref} display="inline-block" color={color('text-title')} {...props} />
));
export type LinkProps = BoxProps & Partial<React.AnchorHTMLAttributes<HTMLAnchorElement>>;
export const Link = React.forwardRef(({ _hover = {}, ...props }: LinkProps, ref) => (
<Text
display="inline-block"
_hover={{
textDecoration: 'underline',
cursor: 'pointer',
..._hover,
}}
ref={ref}
{...props}
/>
));
export const Link: ForwardRefExoticComponentWithAs<LinkProps, 'a'> = forwardRefWithAs(
({ _hover = {}, ...props }: LinkProps, ref) => (
<Text
display="inline-block"
_hover={{
textDecoration: 'underline',
cursor: 'pointer',
..._hover,
}}
ref={ref}
{...props}
/>
)
);

23
src/pages/_app.tsx

@ -1,18 +1,21 @@
import React from 'react';
import type { AppProps } from 'next/app';
import { CSSReset, ThemeProvider } from '@blockstack/ui';
import { AppProps } from 'next/app';
import * as React from 'react';
import 'modern-normalize/modern-normalize.css';
import { AppWrapper } from '@components/app-wrapper';
import { theme } from '@stacks/ui';
import { CacheProvider, ThemeProvider } from '@emotion/react';
import { cache } from '@emotion/css';
import '@docsearch/css';
const MyApp: React.FC<AppProps> = ({ Component, pageProps, ...rest }) => (
<ThemeProvider>
<CSSReset />
<AppWrapper {...rest}>
<Component {...pageProps} />
</AppWrapper>
</ThemeProvider>
<CacheProvider value={cache}>
<ThemeProvider theme={theme}>
<AppWrapper {...rest}>
<Component {...pageProps} />
</AppWrapper>
</ThemeProvider>
</CacheProvider>
);
export default MyApp;

65
src/pages/_document.tsx

@ -2,44 +2,43 @@ import React from 'react';
import Document, {
DocumentContext,
DocumentProps,
DocumentInitialProps,
Html,
Head,
Main,
NextScript,
} from 'next/document';
import { THEME_STORAGE_KEY } from '@common/constants';
import { ServerStyleSheet } from 'styled-components';
import { extractCritical } from '@emotion/server';
import { MdxOverrides } from '@components/mdx/overrides';
import { ColorModes } from '@components/color-modes/styles';
import { ProgressBarStyles } from '@components/progress-bar';
export default class MyDocument extends Document<DocumentProps> {
static async getInitialProps(ctx: DocumentContext) {
const sheet = new ServerStyleSheet();
const originalRenderPage = ctx.renderPage;
try {
ctx.renderPage = () =>
originalRenderPage({
enhanceApp: App => props => sheet.collectStyles(<App {...props} />),
});
const initialProps = await Document.getInitialProps(ctx);
return {
...initialProps,
styles: (
<>
{initialProps.styles}
{sheet.getStyleElement()}
</>
),
};
} finally {
sheet.seal();
}
static async getInitialProps(ctx: DocumentContext): Promise<DocumentInitialProps> {
const page = await ctx.renderPage();
const styles = extractCritical(page.html);
return {
...page,
styles: (
<>
{MdxOverrides}
{ProgressBarStyles}
{ColorModes}
<style
data-emotion-css={styles.ids.join(' ')}
dangerouslySetInnerHTML={{ __html: styles.css }}
/>
</>
),
};
}
render() {
return (
<Html lang="en">
<Head>
<meta name="color-scheme" content="light dark" />
<link
rel="preload"
href="/static/fonts/soehne-mono-web-buch.woff2"
@ -110,15 +109,15 @@ export default class MyDocument extends Document<DocumentProps> {
<script
dangerouslySetInnerHTML={{
__html: `(function() {
try {
var mode = localStorage.getItem('${THEME_STORAGE_KEY}')
if (!mode) return
document.documentElement.classList.add(mode)
var bgValue = getComputedStyle(document.documentElement)
.getPropertyValue('--colors-bg')
document.documentElement.style.background = bgValue
} catch (e) {}
})()`,
try {
var mode = localStorage.getItem('${THEME_STORAGE_KEY}')
if (!mode) return
document.documentElement.classList.add(mode)
var bgValue = getComputedStyle(document.documentElement)
.getPropertyValue('--colors-bg')
document.documentElement.style.background = bgValue
} catch (e) {}
})()`,
}}
/>
<link rel="preconnect" href="https://bh4d9od16a-dsn.algolia.net" crossOrigin="true" />

10
src/pages/references/faqs/[slug].tsx

@ -1,10 +1,10 @@
import React from 'react';
import { Components } from '@components/mdx';
import { Box, Flex, ChevronIcon, space, color, Grid } from '@blockstack/ui';
import { Box, Flex, ChevronIcon, space, color, Grid } from '@stacks/ui';
import hydrate from 'next-mdx-remote/hydrate';
import { Accordion, AccordionItem, AccordionButton, AccordionPanel } from '@reach/accordion';
import { border } from '@common/utils';
import { css } from '@styled-system/css';
import { css } from '@stacks/ui-core';
import { useRouter } from 'next/router';
import { useActiveHeading } from '@common/hooks/use-active-heading';
import { BackButton } from '@components/back-button';
@ -25,7 +25,7 @@ const FAQItem = React.memo(({ faq, ...rest }: any) => {
<Flex
as={AccordionButton}
_hover={{ color: color('accent') }}
css={css({
{...{
display: 'flex',
width: '100%',
outline: 'none',
@ -34,10 +34,10 @@ const FAQItem = React.memo(({ faq, ...rest }: any) => {
py: space('extra-loose'),
textAlign: 'left',
color: isActive ? color('accent') : color('text-title'),
':hover': {
_hover: {
color: color('accent'),
},
})}
}}
>
<Components.h4 my="0px !important" id={id} color="currentColor">
{faq.title}

7
src/pages/stacks-wallet/usage.md

@ -225,10 +225,9 @@ Sending stacks is a transaction you must authorize or sign. If you have connecte
4. Complete the dialog with the transaction information.
| **Recipient** | A Stacks address. |
| **Amount to Send** | Enter a value. |
| **Note** | A memo for the transaction. |
| **Recipient** | A Stacks address. |
| **Amount to Send** | Enter a value. |
| **Note** | A memo for the transaction. |
5. Select **Continue**.

27
src/pages/storage-hubs/amazon-s3-deploy.md

@ -37,32 +37,31 @@ If `watch` is not located, install it on your workstation.
## Task 1: Launch an EC2 instance
1. Visit the [AWS Free Tier page](https://aws.amazon.com/free/) and choose **Sign in to the Console**.
1. Visit the [AWS Free Tier page](https://aws.amazon.com/free/) and choose **Sign in to the Console**.
![](/images/aws-console.png)
2. Make sure your region is set to one close to you.
![](/images/aws-console.png)
![](/images/us-west-2.png)
2. Make sure your region is set to one close to you.
3. Under **Build a solution** choose **Launch a virtual machine**.
![](/images/us-west-2.png)
The system opens the EC2 dashboard.
3. Under **Build a solution** choose **Launch a virtual machine**.
4. Enter `blockstack-gaia` in the search bar.
The system opens the EC2 dashboard.
The system finds AMIs in the Marketplace and the Community.
4. Enter `blockstack-gaia` in the search bar.
5. Choose **Community AMIs**.
The system finds AMIs in the Marketplace and the Community.
The system displays the available Gaia hub images.
5. Choose **Community AMIs**.
![](/images/gaia-community.png)
The system displays the available Gaia hub images.
Each image name has this format:
![](/images/gaia-community.png)
`blockstack-gaia_hub-STORAGETYPE-VERSION-hvm - ami-BUILDTAG`
Each image name has this format:
`blockstack-gaia_hub-STORAGETYPE-VERSION-hvm - ami-BUILDTAG`
You can choose an image that uses **ephemeral** or **EBS** storage. The ephemeral
storage is very small but free. Only choose this if you plan to test or use

11
src/pages/storage-hubs/digital-ocean-deploy.md

@ -459,12 +459,11 @@ This runs your Gaia hub on port `3000`. If everything runs successfully, the las
This command includes `-d` option to `docker run`. This runs Docker in detached mode, so that it runs in the background. You can run `docker ps` to see your running docker images, and get the `id` of your Gaia server.
```bash
root@meepers:~/gaia/hub# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
aeca7eea4a86 gaia.hub "npm run start" 11 seconds ago Up 10 seconds 0.0.0.0:3000->3000/tcp musing_payne
```
```bash
root@meepers:~/gaia/hub# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
aeca7eea4a86 gaia.hub "npm run start" 11 seconds ago Up 10 seconds 0.0.0.0:3000->3000/tcp musing_payne
```
At this point, your Gaia service is up and running. You can run `docker logs MY_CONTAINER_ID` with your running image's ID to see the logs of this server at any time.

23
tsconfig.json

@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
@ -15,13 +19,22 @@
"isolatedModules": true,
"jsx": "preserve",
"paths": {
"@components/*": ["components/*"],
"@pages/*": ["pages/*"],
"@common/*": ["common/*"]
"@components/*": [
"components/*"
],
"@pages/*": [
"pages/*"
],
"@common/*": [
"common/*"
]
},
"baseUrl": "src"
},
"exclude": ["node_modules", ".next"],
"exclude": [
"node_modules",
".next"
],
"include": [
"**/src/**/*.ts",
"**/test/**/*.ts",

1048
yarn.lock

File diff suppressed because it is too large
Loading…
Cancel
Save