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 = { module.exports = {
presets: ['next/babel'], presets: ['next/babel', '@emotion/babel-preset-css-prop'],
plugins: [ plugins: ['./lib/babel-plugin-nextjs-mdx-patch', 'babel-plugin-macros', '@emotion'],
'./lib/babel-plugin-nextjs-mdx-patch',
'babel-plugin-macros',
['styled-components', { ssr: true }],
],
}; };

4
next.config.js

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

55
package.json

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

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

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

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

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

4
src/common/utils/index.ts

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

4
src/components/app-wrapper.tsx

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

4
src/components/back-button.tsx

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

2
src/components/clarity-ref.tsx

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

2
src/components/cli-reference.tsx

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import cliReferenceData from '../_data/cli-reference.json'; import cliReferenceData from '../_data/cli-reference.json';
import { Components } from '@components/mdx/mdx-components'; 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 { border, onlyText, slugify } from '@common/utils';
import hydrate from 'next-mdx-remote/hydrate'; import hydrate from 'next-mdx-remote/hydrate';

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

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

11
src/components/content-wrapper.tsx

@ -1,14 +1,19 @@
import React from 'react'; 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 <Flex
flexShrink={0} flexShrink={0}
pt={space(['base', 'base', 'extra-loose'])} pt={space(['base', 'base', 'extra-loose'])}
pb={[4, 4, 6]} pb={[4, 4, 6]}
flexDirection="column" flexDirection="column"
ref={ref}
{...props} {...props}
/> />
); ));
export { ContentWrapper }; export { ContentWrapper };

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

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

29
src/components/example.tsx

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

22
src/components/faq.tsx

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

16
src/components/feedback.tsx

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

2
src/components/footer.tsx

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

30
src/components/glossary.tsx

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

47
src/components/header.tsx

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

2
src/components/home/card.tsx

@ -1,5 +1,5 @@
import React from 'react'; 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 NextLink from 'next/link';
import { useTouchable } from '@common/hooks/use-touchable'; import { useTouchable } from '@common/hooks/use-touchable';

17
src/components/home/common.tsx

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

2
src/components/home/footer.tsx

@ -1,5 +1,5 @@
import React from 'react'; 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 { Section, SectionWrapper } from '@components/home/common';
import { Text } from '@components/typography'; import { Text } from '@components/typography';

2
src/components/home/grid.tsx

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

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

@ -1,5 +1,5 @@
import React from 'react'; 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 { transition } from '@common/utils';
import { Img } from '@components/mdx/image'; import { Img } from '@components/mdx/image';

2
src/components/icon-button.tsx

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

6
src/components/icons/_base.tsx

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

5
src/components/icons/accessible.tsx

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

6
src/components/icons/atom.tsx

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

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

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

6
src/components/icons/feedback.tsx

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

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

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

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

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

6
src/components/icons/package.tsx

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

6
src/components/icons/paint.tsx

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

6
src/components/icons/palette.tsx

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

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

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

37
src/components/lazy-image.tsx

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

2
src/components/main.tsx

@ -1,5 +1,5 @@
import React from 'react'; 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} />; 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 React from 'react';
import { border } from '@common/utils'; 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 { CheckCircleIcon } from '@components/icons/check-circle';
import { AlertTriangleIcon } from '@components/icons/alert-triangle'; import { AlertTriangleIcon } from '@components/icons/alert-triangle';
import { AlertCircleIcon } from '@components/icons/alert-circle'; import { AlertCircleIcon } from '@components/icons/alert-circle';
@ -61,12 +61,12 @@ export const Blockquote: React.FC<BoxProps> = React.memo(
display="block" display="block"
my={space('extra-loose')} my={space('extra-loose')}
className={className} className={className}
ref={ref} ref={ref as any}
{...rest} {...rest}
> >
<Box <Box
border="1px solid" border="1px solid"
css={css({ {...{
position: 'relative', position: 'relative',
display: 'grid', display: 'grid',
placeItems: 'center', placeItems: 'center',
@ -78,15 +78,19 @@ export const Blockquote: React.FC<BoxProps> = React.memo(
boxShadow: isAlert ? 'mid' : 'unset', boxShadow: isAlert ? 'mid' : 'unset',
py: space('base'), py: space('base'),
px: space('base'), px: space('base'),
'& p': { }}
flexGrow: 1, css={theme =>
pt: '4px', css({
}, '& p': {
...styles, flexGrow: 1,
})} pt: '4px',
},
})(theme)
}
{...styles}
> >
{Icon && ( {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"> <Box position="absolute" top="16px" size="22px">
<Icon /> <Icon />
</Box> </Box>

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

@ -1,9 +1,9 @@
import React, { Children } from 'react'; 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 { ClipboardCheckIcon } from '@components/icons/clipboard-check';
import { border, onlyText } from '@common/utils'; import { border, onlyText } from '@common/utils';
import { css } from '@styled-system/css'; import { css } from '@stacks/ui-core';
import { Text } from '@components/typography'; import { Text } from '@components/typography';
import { useHover } from 'use-events'; import { useHover } from 'use-events';
import { IconButton } from '@components/icon-button'; import { IconButton } from '@components/icon-button';
@ -66,16 +66,23 @@ export const Code: React.FC<
> >
<Box <Box
as="code" as="code"
css={css({ {...{
width: '100%', width: '100%',
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
minWidth: 'fit-content', 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': { '.token-line': {
display: 'inline-block', display: 'inline-block',
...generateCssStylesForHighlightedLines(numbers), ...generateCssStylesForHighlightedLines(numbers),
}, },
counterReset: 'line',
'& .token-line': { '& .token-line': {
'&__empty': { '&__empty': {
height: '24px', 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} {...rest}
> >
@ -188,14 +190,12 @@ const preProps = {
export const InlineCode: React.FC<BoxProps> = ({ children, ...rest }) => ( export const InlineCode: React.FC<BoxProps> = ({ children, ...rest }) => (
<Text <Text
as="code" as="code"
css={css({ {...preProps}
// @ts-ignore {...{
fontSize: '14px', fontSize: '14px',
// @ts-ignore
lineHeight: '20px', lineHeight: '20px',
...preProps, }}
...rest, {...rest}
})}
> >
{children} {children}
</Text> </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 React from 'react';
import LinkIcon from 'mdi-react/LinkVariantIcon'; import LinkIcon from 'mdi-react/LinkVariantIcon';
@ -7,10 +7,10 @@ import { useTouchable } from '@common/hooks/use-touchable';
import { Tooltip } from '@components/tooltip'; import { Tooltip } from '@components/tooltip';
import { useActiveHeading } from '@common/hooks/use-active-heading'; import { useActiveHeading } from '@common/hooks/use-active-heading';
import { Title } from '@components/typography'; import { Title } from '@components/typography';
import { css } from '@styled-system/css';
import { getHeadingStyles, baseTypeStyles } from '@components/mdx/typography'; import { getHeadingStyles, baseTypeStyles } from '@components/mdx/typography';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { Link } from '@components/mdx/components/link'; 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 LinkButton = React.memo(({ link, onClick, ...rest }: BoxProps & { link: string }) => {
const url = 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 // 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 ? ( id ? (
<Box <Box
as="span" as="span"
@ -65,7 +65,7 @@ const Hashtag = () => (
<Flex <Flex
position="absolute" position="absolute"
as="span" as="span"
align="center" alignItems="center"
size="20px" size="20px"
left={['12px', '12px', '-20px', '-20px']} left={['12px', '12px', '-20px', '-20px']}
color={color('text-caption')} color={color('text-caption')}
@ -74,51 +74,51 @@ const Hashtag = () => (
</Flex> </Flex>
); );
export const Heading = ({ as, children, id, ...rest }: FlexProps) => { export const Heading: ForwardRefExoticComponentWithAs<
const { isActive, doChangeActiveSlug } = useActiveHeading(id); 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 { bind: _bind, hover, active } = useTouchable();
const router = useRouter(); const router = useRouter();
const link = `#${id}`; const link = `#${id}`;
const handleLinkClick = () => { const handleLinkClick = () => {
void router.push(router.pathname, router.pathname + link, { shallow: true }); void router.push(router.pathname, router.pathname + link, { shallow: true });
doChangeActiveSlug(id); doChangeActiveSlug(id);
}; };
const styles = getHeadingStyles(as as any); const styles = getHeadingStyles(as as any);
const bind = id ? _bind : {}; const bind = id ? _bind : {};
return ( return (
<Title <Title
as={as} as={as}
{...bind} {...bind}
css={css({ {...{
...baseTypeStyles, ...baseTypeStyles,
...styles, ...styles,
color: isActive ? color('accent') : (color('text-title') as any), color: isActive ? color('accent') : (color('text-title') as any),
// @ts-ignore alignItems: 'center',
alignItems: 'center', position: 'relative',
// @ts-ignore display: 'flex',
position: 'relative', justifyContent: 'flex-start',
// @ts-ignore cursor: id && hover ? 'pointer' : 'unset',
display: 'flex', }}
// @ts-ignore {...rest}
justifyContent: 'flex-start', >
// @ts-ignore <Box as="span">{children}</Box>
cursor: id && hover ? 'pointer' : 'unset', <AnchorOffset id={id} />
...rest, {id && isActive && <Hashtag />}
})} {id && <LinkButton opacity={hover ? 1 : 0} link={link} />}
> </Title>
<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 => ( export const BaseHeading: React.FC<BoxProps> = React.memo(({ ...props }) => (
<Heading width="100%" mt={space('base-loose')} {...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 NextLink from 'next/link';
import React, { forwardRef, Ref } from 'react'; import React, { forwardRef, Ref } from 'react';
import { useAppState } from '@common/hooks/use-app-state'; import { useAppState } from '@common/hooks/use-app-state';
import { border, transition } from '@common/utils'; import { border, transition } from '@common/utils';
import { Text } from '@components/typography'; import { Text } from '@components/typography';
import { useTouchable } from '@common/hooks/use-touchable'; 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 { getHeadingStyles } from '@components/mdx/typography';
import { PageMeta } from '@components/page-meta'; 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')}> <Box as="span" display="block" bg={color('bg-light')} p={space('base')}>
<Text <Text
css={css({ {...{
...getHeadingStyles('h5'), ...getHeadingStyles('h5'),
display: 'block', display: 'block',
})} }}
> >
{description} {description}
</Text> </Text>
@ -120,23 +120,18 @@ export const LinkWithHover = forwardRef(
} }
); );
export const Link = forwardRef( export const Link = forwardRefWithAs<BoxProps, 'a'>((props, ref) => {
( return (
props: { href?: string; target?: string; rel?: string } & BoxProps, <Box
ref: Ref<HTMLDivElement> as={props.href ? 'a' : 'span'}
) => { ref={ref}
return ( color="var(--colors-accent)"
<Box cursor="pointer"
as={props.href ? 'a' : 'span'} textDecoration="none"
ref={ref} _hover={{ textDecoration: 'underline' }}
color="var(--colors-accent)" _focus={{ boxShadow: 'outline' }}
cursor="pointer" rel="nofollow noopener noreferrer"
textDecoration="underline" {...props}
_hover={{ textDecoration: 'none' }} />
_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'; import React, { forwardRef, Ref } from 'react';
export const Ol: React.FC<BoxProps> = props => ( export const Ol: React.FC<BoxProps> = props => (

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

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Box, BoxProps } from '@blockstack/ui'; import { Box, BoxProps } from '@stacks/ui';
export const Section: React.FC<BoxProps> = React.memo( export const Section: React.FC<BoxProps> = React.memo(
React.forwardRef(({ children, ...rest }, ref) => { 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 React from 'react';
import { P } from '@components/mdx/components'; import { P } from '@components/mdx/components';
import { border } from '@common/utils'; 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 React from 'react';
import { Text } from '@components/typography'; import { Text } from '@components/typography';
import { BaseHeading } from '@components/mdx/components/heading'; 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 H1: ForwardRefExoticComponentWithAs<BoxProps, 'h1'> = forwardRefWithAs<BoxProps, 'h1'>(
export const H2: React.FC<BoxProps> = props => <BaseHeading as="h2" {...props} />; (props, ref) => <BaseHeading as="h1" ref={ref} {...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 H2: ForwardRefExoticComponentWithAs<BoxProps, 'h2'> = forwardRefWithAs<BoxProps, 'h2'>(
export const H5: React.FC<BoxProps> = props => <BaseHeading as="h5" {...props} />; (props, ref) => <BaseHeading as="h2" ref={ref} {...props} />
export const H6: React.FC<BoxProps> = props => <BaseHeading as="h6" {...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 Br: ForwardRefExoticComponentWithAs<BoxProps, 'br'> = forwardRefWithAs<BoxProps, 'br'>(
export const Hr: React.FC<BoxProps> = props => ( props => <Box height="24px" {...props} />
<Box as="hr" borderTopWidth="1px" borderColor={color('border')} my={'64px'} {...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 Pre: ForwardRefExoticComponentWithAs<BoxProps, 'pre'> = forwardRefWithAs<
export const Sup: React.FC<any> = props => <Text as="sup" mr={space('extra-tight')} {...props} />; 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 React from 'react';
import { Box, BoxProps } from '@blockstack/ui'; import { Box, BoxProps } from '@stacks/ui';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { ForwardRefExoticComponentWithAs, forwardRefWithAs } from '@stacks/ui-core';
const imgix = 'https://stacks-documentation.imgix.net'; const imgix = 'https://stacks-documentation.imgix.net';
@ -18,7 +19,7 @@ const getUrl = pathname => {
}; };
const useImgix = (src: string) => { const useImgix = (src: string) => {
if (process.env.NODE_ENV !== 'production' || !src) if (process.env.NEXT_PUBLIC_STAGING || process.env.NODE_ENV !== 'production' || !src)
return { return {
src, src,
srcset: undefined, srcset: undefined,
@ -56,30 +57,29 @@ const getAspectRatio = dimensions => {
return (height / width) * 100; return (height / width) * 100;
}; };
const BaseImg: React.FC< const BaseImg: ForwardRefExoticComponentWithAs<BoxProps, 'img'> = forwardRefWithAs<BoxProps, 'img'>(
BoxProps & { ({ as = 'img', style = {}, ...props }, ref) => {
src?: string; return (
srcSet?: string; <Box
loading?: string; 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< export const Img: ForwardRefExoticComponentWithAs<
BoxProps & { loading?: string; src?: string; alt?: string; dimensions?: any } BoxProps & { loading?: string; dimensions?: any },
'img'
> = React.memo(({ src: _src, dimensions, ...rest }) => { > = React.memo(({ src: _src, dimensions, ...rest }) => {
const { src, srcset } = useImgix(_src); const { src, srcset } = useImgix(_src);
@ -99,9 +99,9 @@ export const Img: React.FC<
return ( return (
<Box width={width} maxWidth="100%" padding="0 !important" position="relative" className="img"> <Box width={width} maxWidth="100%" padding="0 !important" position="relative" className="img">
<Box height="0" paddingBottom={`${aspectRatio}%`} width="100%" /> <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> </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 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 { ContentWrapper } from '../content-wrapper';
import { TableOfContents } from '@components/toc'; import { TableOfContents } from '@components/toc';
import { css } from '@styled-system/css';
import { TOC_WIDTH } from '@common/constants'; import { TOC_WIDTH } from '@common/constants';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
@ -11,7 +10,8 @@ import { border } from '@common/utils';
import { getCapsizeStyles } from '@components/mdx/typography'; import { getCapsizeStyles } from '@components/mdx/typography';
import { MDXProvider } from '@mdx-js/react'; import { MDXProvider } from '@mdx-js/react';
import { MDXComponents } from '@components/mdx'; import { MDXComponents } from '@components/mdx';
export const styleOverwrites = { import { css, ThemeUICSSObject } from '@stacks/ui-core';
export const styleOverwrites: ThemeUICSSObject = {
'& > section': { '& > section': {
'&:nth-child(2)': { '&:nth-child(2)': {
'& > *:first-child, & > section:first-child > *:first-child': { '& > *:first-child, & > section:first-child > *:first-child': {
@ -75,7 +75,7 @@ export const styleOverwrites = {
'p, li': { 'p, li': {
overflowWrap: 'break-word', overflowWrap: 'break-word',
display: 'inline-block', display: 'inline-block',
...getCapsizeStyles(16, 26), ...getCapsizeStyles(16, 26, ':'),
}, },
li: { li: {
'& > p': { '& > p': {
@ -129,7 +129,7 @@ export const styleOverwrites = {
h2: { h2: {
mt: '64px', mt: '64px',
'&, & > *': { '&, & > *': {
...getHeadingStyles('h2'), ...getHeadingStyles('h2', ':'),
}, },
'& > code': { '& > code': {
px: space('tight'), px: space('tight'),
@ -144,7 +144,7 @@ export const styleOverwrites = {
h3: { h3: {
mt: '64px', mt: '64px',
'&, & > *': { '&, & > *': {
...getHeadingStyles('h3'), ...getHeadingStyles('h3', ':'),
}, },
'& + section > h4': { '& + section > h4': {
mt: 0, mt: 0,
@ -153,7 +153,7 @@ export const styleOverwrites = {
h4: { h4: {
mt: '64px', mt: '64px',
'&, & > *': { '&, & > *': {
...getHeadingStyles('h4'), ...getHeadingStyles('h4', ':'),
}, },
'& + section > h5': { '& + section > h5': {
mt: 0, mt: 0,
@ -162,19 +162,19 @@ export const styleOverwrites = {
h5: { h5: {
mt: space('extra-loose'), mt: space('extra-loose'),
'&, & > *': { '&, & > *': {
...getHeadingStyles('h5'), ...getHeadingStyles('h5', ':'),
}, },
}, },
h6: { h6: {
mt: space('extra-loose'), mt: space('extra-loose'),
'&, & > *': { '&, & > *': {
...getHeadingStyles('h6'), ...getHeadingStyles('h6', ':'),
}, },
}, },
h1: { h1: {
mt: space('extra-loose'), mt: space('extra-loose'),
'&, & > *': { '&, & > *': {
...getHeadingStyles('h1'), ...getHeadingStyles('h1', ':'),
}, },
'& + *': { '& + *': {
mt: space('extra-loose'), mt: space('extra-loose'),
@ -251,9 +251,9 @@ export const MDContents: React.FC<any> = ({ pageTop: PageTop = null, headings, c
<> <>
<ContentWrapper <ContentWrapper
width={['100%', '100%', '100%', `calc(100% - ${isHome ? 0 : TOC_WIDTH}px)`]} width={['100%', '100%', '100%', `calc(100% - ${isHome ? 0 : TOC_WIDTH}px)`]}
mx="unset" mx="0"
pt="unset" pt="0"
css={css(styleOverwrites as any)} css={theme => css(styleOverwrites)(theme)}
pr={!isHome && ['0', '0', '0', 'extra-loose']} pr={!isHome && ['0', '0', '0', 'extra-loose']}
> >
{PageTop && <PageTop />} {PageTop && <PageTop />}

220
src/components/mdx/overrides.tsx

@ -1,103 +1,125 @@
import React from 'react'; import React from 'react';
import { color } from '@blockstack/ui'; import { color } from '@stacks/ui';
import { createGlobalStyle } from 'styled-components'; import { css, Global } from '@emotion/react';
const GlobalStyles = createGlobalStyle` const GlobalStyles = (
:root { <Global
--reach-tooltip: 1; 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')};
}
* { pre {
font-feature-settings: "onum" 1, "pnum" 1, "kern" 1, "ss01" 1; display: inline-block;
} }
html, body { p,
font-family: 'Soehne', Inter, sans-serif; ul,
} ol,
@counter-style list { table {
pad: "0"; color: ${color('text-body')};
} a > pre {
img{ color: ${color('accent')} !important;
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 />
</>
); );
export const MdxOverrides = GlobalStyles;

2
src/components/mdx/styles.tsx

@ -1,5 +1,5 @@
import React from 'react'; 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 { getHeadingStyles } from '@components/mdx/typography';
import { border } from '@common/utils'; import { border } from '@common/utils';
import { getCapsizeStyles } from '@components/mdx/typography'; import { getCapsizeStyles } from '@components/mdx/typography';

70
src/components/mdx/typography.ts

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

4
src/components/mobile-menu.tsx

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

26
src/components/page-meta.tsx

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

12
src/components/page-top.tsx

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

18
src/components/pagination.tsx

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

15
src/components/progress-bar.tsx

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

16
src/components/search.tsx

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

39
src/components/side-nav.tsx

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

12
src/components/status-check.tsx

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

9
src/components/toc.tsx

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

2
src/components/tooltip.tsx

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

49
src/components/typography.tsx

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

23
src/pages/_app.tsx

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

65
src/pages/_document.tsx

@ -2,44 +2,43 @@ import React from 'react';
import Document, { import Document, {
DocumentContext, DocumentContext,
DocumentProps, DocumentProps,
DocumentInitialProps,
Html, Html,
Head, Head,
Main, Main,
NextScript, NextScript,
} from 'next/document'; } from 'next/document';
import { THEME_STORAGE_KEY } from '@common/constants'; 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> { export default class MyDocument extends Document<DocumentProps> {
static async getInitialProps(ctx: DocumentContext) { static async getInitialProps(ctx: DocumentContext): Promise<DocumentInitialProps> {
const sheet = new ServerStyleSheet(); const page = await ctx.renderPage();
const originalRenderPage = ctx.renderPage; const styles = extractCritical(page.html);
return {
try { ...page,
ctx.renderPage = () => styles: (
originalRenderPage({ <>
enhanceApp: App => props => sheet.collectStyles(<App {...props} />), {MdxOverrides}
}); {ProgressBarStyles}
{ColorModes}
const initialProps = await Document.getInitialProps(ctx); <style
return { data-emotion-css={styles.ids.join(' ')}
...initialProps, dangerouslySetInnerHTML={{ __html: styles.css }}
styles: ( />
<> </>
{initialProps.styles} ),
{sheet.getStyleElement()} };
</>
),
};
} finally {
sheet.seal();
}
} }
render() { render() {
return ( return (
<Html lang="en"> <Html lang="en">
<Head> <Head>
<meta name="color-scheme" content="light dark" />
<link <link
rel="preload" rel="preload"
href="/static/fonts/soehne-mono-web-buch.woff2" href="/static/fonts/soehne-mono-web-buch.woff2"
@ -110,15 +109,15 @@ export default class MyDocument extends Document<DocumentProps> {
<script <script
dangerouslySetInnerHTML={{ dangerouslySetInnerHTML={{
__html: `(function() { __html: `(function() {
try { try {
var mode = localStorage.getItem('${THEME_STORAGE_KEY}') var mode = localStorage.getItem('${THEME_STORAGE_KEY}')
if (!mode) return if (!mode) return
document.documentElement.classList.add(mode) document.documentElement.classList.add(mode)
var bgValue = getComputedStyle(document.documentElement) var bgValue = getComputedStyle(document.documentElement)
.getPropertyValue('--colors-bg') .getPropertyValue('--colors-bg')
document.documentElement.style.background = bgValue document.documentElement.style.background = bgValue
} catch (e) {} } catch (e) {}
})()`, })()`,
}} }}
/> />
<link rel="preconnect" href="https://bh4d9od16a-dsn.algolia.net" crossOrigin="true" /> <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 React from 'react';
import { Components } from '@components/mdx'; 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 hydrate from 'next-mdx-remote/hydrate';
import { Accordion, AccordionItem, AccordionButton, AccordionPanel } from '@reach/accordion'; import { Accordion, AccordionItem, AccordionButton, AccordionPanel } from '@reach/accordion';
import { border } from '@common/utils'; import { border } from '@common/utils';
import { css } from '@styled-system/css'; import { css } from '@stacks/ui-core';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { useActiveHeading } from '@common/hooks/use-active-heading'; import { useActiveHeading } from '@common/hooks/use-active-heading';
import { BackButton } from '@components/back-button'; import { BackButton } from '@components/back-button';
@ -25,7 +25,7 @@ const FAQItem = React.memo(({ faq, ...rest }: any) => {
<Flex <Flex
as={AccordionButton} as={AccordionButton}
_hover={{ color: color('accent') }} _hover={{ color: color('accent') }}
css={css({ {...{
display: 'flex', display: 'flex',
width: '100%', width: '100%',
outline: 'none', outline: 'none',
@ -34,10 +34,10 @@ const FAQItem = React.memo(({ faq, ...rest }: any) => {
py: space('extra-loose'), py: space('extra-loose'),
textAlign: 'left', textAlign: 'left',
color: isActive ? color('accent') : color('text-title'), color: isActive ? color('accent') : color('text-title'),
':hover': { _hover: {
color: color('accent'), color: color('accent'),
}, },
})} }}
> >
<Components.h4 my="0px !important" id={id} color="currentColor"> <Components.h4 my="0px !important" id={id} color="currentColor">
{faq.title} {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. 4. Complete the dialog with the transaction information.
| **Recipient** | A Stacks address. |
| **Recipient** | A Stacks address. | | **Amount to Send** | Enter a value. |
| **Amount to Send** | Enter a value. | | **Note** | A memo for the transaction. |
| **Note** | A memo for the transaction. |
5. Select **Continue**. 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 ## 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) ![](/images/aws-console.png)
2. Make sure your region is set to one close to you.
![](/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 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 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. 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
```bash root@meepers:~/gaia/hub# docker ps
root@meepers:~/gaia/hub# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
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
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. 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": { "compilerOptions": {
"target": "es5", "target": "es5",
"lib": ["dom", "dom.iterable", "esnext"], "lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true, "allowJs": true,
"skipLibCheck": true, "skipLibCheck": true,
"strict": false, "strict": false,
@ -15,13 +19,22 @@
"isolatedModules": true, "isolatedModules": true,
"jsx": "preserve", "jsx": "preserve",
"paths": { "paths": {
"@components/*": ["components/*"], "@components/*": [
"@pages/*": ["pages/*"], "components/*"
"@common/*": ["common/*"] ],
"@pages/*": [
"pages/*"
],
"@common/*": [
"common/*"
]
}, },
"baseUrl": "src" "baseUrl": "src"
}, },
"exclude": ["node_modules", ".next"], "exclude": [
"node_modules",
".next"
],
"include": [ "include": [
"**/src/**/*.ts", "**/src/**/*.ts",
"**/test/**/*.ts", "**/test/**/*.ts",

1048
yarn.lock

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