@myst-theme/site 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myst-theme/site",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "main": "./src/index.ts",
5
5
  "types": "./src/index.ts",
6
6
  "files": [
@@ -16,22 +16,22 @@
16
16
  "dependencies": {
17
17
  "@headlessui/react": "^1.7.15",
18
18
  "@heroicons/react": "^2.0.18",
19
- "@myst-theme/diagrams": "^0.5.1",
20
- "@myst-theme/frontmatter": "^0.5.1",
21
- "@myst-theme/jupyter": "^0.5.1",
22
- "@myst-theme/common": "^0.5.1",
23
- "@myst-theme/providers": "^0.5.1",
19
+ "@myst-theme/diagrams": "^0.5.2",
20
+ "@myst-theme/frontmatter": "^0.5.2",
21
+ "@myst-theme/jupyter": "^0.5.2",
22
+ "@myst-theme/common": "^0.5.2",
23
+ "@myst-theme/providers": "^0.5.2",
24
24
  "classnames": "^2.3.2",
25
25
  "lodash.throttle": "^4.1.1",
26
26
  "myst-common": "^1.1.1",
27
27
  "myst-spec-ext": "^1.1.1",
28
28
  "myst-config": "^1.1.1",
29
- "myst-demo": "^0.5.1",
30
- "myst-to-react": "^0.5.1",
29
+ "myst-demo": "^0.5.2",
30
+ "myst-to-react": "^0.5.2",
31
31
  "nbtx": "^0.2.3",
32
32
  "node-cache": "^5.1.2",
33
33
  "node-fetch": "^2.6.11",
34
- "thebe-react": "^0.3.0",
34
+ "thebe-react": "^0.3.2",
35
35
  "unist-util-select": "^4.0.1"
36
36
  },
37
37
  "peerDependencies": {
@@ -0,0 +1,40 @@
1
+ import type { GenericParent } from 'myst-common';
2
+ import { ContentBlocks } from './ContentBlocks';
3
+ import classNames from 'classnames';
4
+
5
+ export function Abstract({ content }: { content: GenericParent }) {
6
+ if (!content) return null;
7
+ return (
8
+ <>
9
+ <span className="mb-3 font-semibold">Abstract</span>
10
+ <div className="px-6 py-1 mb-3 rounded-sm bg-slate-50 dark:bg-slate-800">
11
+ <ContentBlocks mdast={content} className="col-body" />
12
+ </div>
13
+ </>
14
+ );
15
+ }
16
+
17
+ export function Keywords({
18
+ keywords,
19
+ hideKeywords,
20
+ }: {
21
+ keywords?: string[];
22
+ hideKeywords?: boolean;
23
+ }) {
24
+ if (hideKeywords || !keywords || keywords.length === 0) return null;
25
+ return (
26
+ <div className="mb-10">
27
+ <span className="mr-2 font-semibold">Keywords:</span>
28
+ {keywords.map((k, i) => (
29
+ <span
30
+ key={k}
31
+ className={classNames({
32
+ "after:content-[','] after:mr-1": i < keywords.length - 1,
33
+ })}
34
+ >
35
+ {k}
36
+ </span>
37
+ ))}
38
+ </div>
39
+ );
40
+ }
@@ -4,6 +4,7 @@ export { FooterLinksBlock } from './FooterLinksBlock';
4
4
  export { ContentReload } from './ContentReload';
5
5
  export { Bibliography } from './Bibliography';
6
6
  export { ArticleHeader } from './Headers';
7
+ export { Abstract, Keywords } from './Abstract';
7
8
  export { ExternalOrInternalLink } from './ExternalOrInternalLink';
8
9
  export * from './Navigation';
9
10
  export { renderers } from './renderers';
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { ReferencesProvider } from '@myst-theme/providers';
3
- import { Bibliography, ContentBlocks, FooterLinksBlock } from '../components';
3
+ import { Abstract, Bibliography, ContentBlocks, FooterLinksBlock, Keywords } from '../components';
4
4
  import { ErrorDocumentNotFound } from './ErrorDocumentNotFound';
5
5
  import { ErrorProjectNotFound } from './ErrorProjectNotFound';
6
6
  import type { PageLoader } from '@myst-theme/common';
@@ -17,7 +17,6 @@ import {
17
17
  ErrorTray,
18
18
  } from '@myst-theme/jupyter';
19
19
  import { FrontmatterBlock } from '@myst-theme/frontmatter';
20
- import classNames from 'classnames';
21
20
 
22
21
  export const ArticlePage = React.memo(function ({
23
22
  article,
@@ -61,29 +60,8 @@ export const ArticlePage = React.memo(function ({
61
60
  )}
62
61
  {canCompute && article.kind === SourceFileKind.Notebook && <NotebookToolbar showLaunch />}
63
62
  <ErrorTray pageSlug={article.slug} />
64
- {abstract && (
65
- <>
66
- <span className="font-semibold">Abstract</span>
67
- <div className="px-6 py-1 m-3 rounded-sm bg-slate-50 dark:bg-slate-800">
68
- <ContentBlocks mdast={abstract as GenericParent} className="col-body" />
69
- </div>
70
- {!hideKeywords && keywords.length > 0 && (
71
- <div className="mb-10">
72
- <span className="mr-2 font-semibold">Keywords:</span>
73
- {keywords.map((k, i) => (
74
- <span
75
- key={k}
76
- className={classNames({
77
- "after:content-[','] after:mr-1": i < keywords.length - 1,
78
- })}
79
- >
80
- {k}
81
- </span>
82
- ))}
83
- </div>
84
- )}
85
- </>
86
- )}
63
+ <Abstract content={abstract as GenericParent} />
64
+ {abstract && <Keywords keywords={keywords} hideKeywords={hideKeywords} />}
87
65
  <ContentBlocks pageKind={article.kind} mdast={tree as GenericParent} />
88
66
  <Bibliography />
89
67
  <ConnectionStatusTray />