Browse Source

fix: typos #699, #698, #696, removes reading time, chevrons

fix/enable-imgix
Thomas Osmonson 4 years ago
parent
commit
8e5406f495
  1. 5
      lib/mdx-frontmatter-loader.js
  2. 1
      package.json
  3. 5
      src/components/side-nav.tsx
  4. 14
      src/components/toc.tsx
  5. 7
      src/pages/smart-contracts/overview.md
  6. 4
      src/pages/smart-contracts/principals.md
  7. 9
      yarn.lock

5
lib/mdx-frontmatter-loader.js

@ -1,9 +1,6 @@
const fm = require('gray-matter'); const fm = require('gray-matter');
const remark = require('remark'); const remark = require('remark');
const strip = require('strip-markdown'); const strip = require('strip-markdown');
const readingTime = require('reading-time');
const getReadingTime = mdxContent => readingTime(mdxContent);
const getHeadings = mdxContent => { const getHeadings = mdxContent => {
const regex = /\n(#+)(.*)/gm; const regex = /\n(#+)(.*)/gm;
@ -32,13 +29,11 @@ async function mdxFrontmatterLoader(src) {
const callback = this.async(); const callback = this.async();
const { content, data } = fm(src); const { content, data } = fm(src);
const headings = getHeadings(content); const headings = getHeadings(content);
const duration = getReadingTime(content).text;
const code = const code =
`import { MDWrapper } from '@components/mdx/markdown-wrapper'; `import { MDWrapper } from '@components/mdx/markdown-wrapper';
export default function Layout({ children, ...props }){ export default function Layout({ children, ...props }){
return ( return (
<MDWrapper frontmatter={${JSON.stringify({ <MDWrapper frontmatter={${JSON.stringify({
duration,
...data, ...data,
headings, headings,
})}} {...props}> })}} {...props}>

1
package.json

@ -46,7 +46,6 @@
"prettier": "^2.0.5", "prettier": "^2.0.5",
"preval.macro": "^5.0.0", "preval.macro": "^5.0.0",
"react-gesture-responder": "^2.1.0", "react-gesture-responder": "^2.1.0",
"reading-time": "^1.2.0",
"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",

5
src/components/side-nav.tsx

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Flex, Box, color, space, ChevronIcon, BoxProps } from '@blockstack/ui'; import { Flex, Box, color, space, BoxProps } from '@blockstack/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';
@ -284,9 +284,6 @@ const Navigation = () => {
{section.title ? ( {section.title ? (
<Flex width="100%" align="center" mb={space('loose')}> <Flex width="100%" align="center" mb={space('loose')}>
<SectionTitle>{section.title}</SectionTitle> <SectionTitle>{section.title}</SectionTitle>
<Box color={color('text-caption')} size="16px" ml={space('extra-tight')}>
<ChevronIcon direction="down" />
</Box>
</Flex> </Flex>
) : null} ) : null}
{section.pages.map((page, key) => { {section.pages.map((page, key) => {

14
src/components/toc.tsx

@ -11,9 +11,9 @@ import { css } from '@styled-system/css';
const getLevelPadding = (level: number) => { const getLevelPadding = (level: number) => {
switch (level) { switch (level) {
case 2: case 2:
return space('base-loose'); return space('base');
case 3: case 3:
return space('extra-loose'); return space('base-loose');
default: default:
return 0; return 0;
} }
@ -35,8 +35,10 @@ const Item = ({
const isActive = isOnScreen || _isActive; const isActive = isOnScreen || _isActive;
const render = !limit || level <= limit + 1; const render = level === 2;
return render ? (
const adjustedLevel = level - 2;
return adjustedLevel <= 2 ? (
<Box pl={getLevelPadding(level - 2)} py={space('extra-tight')}> <Box pl={getLevelPadding(level - 2)} py={space('extra-tight')}>
<NextLink href={`#${slug}`} passHref> <NextLink href={`#${slug}`} passHref>
<Link <Link
@ -99,7 +101,7 @@ export const TableOfContents = ({
} }
> >
{headings?.map((heading, index) => { {headings?.map((heading, index) => {
return index > 0 ? ( return (
<Item <Item
limit={limit} limit={limit}
level={heading.level} level={heading.level}
@ -107,7 +109,7 @@ export const TableOfContents = ({
label={heading.content} label={heading.content}
key={index} key={index}
/> />
) : null; );
})} })}
</Grid> </Grid>
</Box> </Box>

7
src/pages/smart-contracts/overview.md

@ -53,11 +53,10 @@ can also call public functions from other smart contracts.
Note some of the key Clarity language rules and limitations. Note some of the key Clarity language rules and limitations.
- The only primitive types are booleans, integers, buffers, and principals - The only primitive types are booleans, integers, buffers, and principals.
- Recursion is illegal and there are no anonymous functions. - Recursion is illegal and there are no anonymous functions.
- Looping may only be performed via `map`, `filter`, or `fold` - Looping may only be performed via `map`, `filter`, or `fold`.
- There is support for lists, however, the only variable length lists in the language appear as function inputs; - There is support for lists, however, the only variable length lists in the language appear as function inputs; there is no support for list operations like append or join.
There is no support for list operations like append or join.
- Variables are immutable. - Variables are immutable.
## Learning Clarity ## Learning Clarity

4
src/pages/smart-contracts/principals.md

@ -14,7 +14,7 @@ Assets in the smart contracting language and blockchain are
the principal type may own an asset. For the case of public-key hash the principal type may own an asset. For the case of public-key hash
and multi-signature Stacks addresses, a given principal can operate on and multi-signature Stacks addresses, a given principal can operate on
their assets by issuing a signed transaction on the blockchain. _Smart their assets by issuing a signed transaction on the blockchain. _Smart
contracts_ may also be principals (reprepresented by the smart contracts_ may also be principals (represented by the smart
contract's identifier), however, there is no private key associated contract's identifier), however, there is no private key associated
with the smart contract, and it cannot broadcast a signed transaction with the smart contract, and it cannot broadcast a signed transaction
on the blockchain. on the blockchain.
@ -71,7 +71,7 @@ For convenience, smart contracts may write a contract's identifier in the
form `.contract-name`. This will be expanded by the Clarity interpreter into form `.contract-name`. This will be expanded by the Clarity interpreter into
a fully-qualified contract identifier that corresponds to the same a fully-qualified contract identifier that corresponds to the same
publishing address as the contract it appears in. For example, if the publishing address as the contract it appears in. For example, if the
same publisher key, `SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR`, is same publisher address, `SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR`, is
publishing two contracts, `contract-A` and `contract-B`, the fully publishing two contracts, `contract-A` and `contract-B`, the fully
qualified identifier for the contracts would be: qualified identifier for the contracts would be:

9
yarn.lock

@ -7133,11 +7133,6 @@ readdirp@~3.4.0:
dependencies: dependencies:
picomatch "^2.2.1" picomatch "^2.2.1"
reading-time@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/reading-time/-/reading-time-1.2.0.tgz#ced71c06715762f805506328dcc1fd45d8249ac4"
integrity sha512-5b4XmKK4MEss63y0Lw0vn0Zn6G5kiHP88mUnD8UeEsyORj3sh1ghTH0/u6m1Ax9G2F4wUZrknlp6WlIsCvoXVA==
reduce@^1.0.1: reduce@^1.0.1:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/reduce/-/reduce-1.0.2.tgz#0cd680ad3ffe0b060e57a5c68bdfce37168d361b" resolved "https://registry.yarnpkg.com/reduce/-/reduce-1.0.2.tgz#0cd680ad3ffe0b060e57a5c68bdfce37168d361b"
@ -9034,9 +9029,9 @@ vm-browserify@1.1.2, vm-browserify@^1.0.1:
resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0" resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0"
integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ== integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==
"vscode-textmate@git+https://github.com/octref/vscode-textmate.git": "vscode-textmate@https://github.com/octref/vscode-textmate":
version "4.0.1" version "4.0.1"
resolved "git+https://github.com/octref/vscode-textmate.git#e65aabe2227febda7beaad31dd0fca1228c5ddf3" resolved "https://github.com/octref/vscode-textmate#e65aabe2227febda7beaad31dd0fca1228c5ddf3"
w3c-hr-time@^1.0.2: w3c-hr-time@^1.0.2:
version "1.0.2" version "1.0.2"

Loading…
Cancel
Save