@myst-theme/site 0.2.9 → 0.3.0

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.2.9",
3
+ "version": "0.3.0",
4
4
  "main": "./src/index.ts",
5
5
  "types": "./src/index.ts",
6
6
  "files": [
@@ -16,21 +16,21 @@
16
16
  "dependencies": {
17
17
  "@headlessui/react": "^1.7.13",
18
18
  "@heroicons/react": "^2.0.14",
19
- "@myst-theme/diagrams": "^0.2.9",
20
- "@myst-theme/frontmatter": "^0.2.9",
21
- "@myst-theme/jupyter": "^0.2.9",
22
- "@myst-theme/providers": "^0.2.9",
19
+ "@myst-theme/diagrams": "^0.3.0",
20
+ "@myst-theme/frontmatter": "^0.3.0",
21
+ "@myst-theme/jupyter": "^0.3.0",
22
+ "@myst-theme/providers": "^0.3.0",
23
23
  "classnames": "^2.3.2",
24
24
  "lodash.throttle": "^4.1.1",
25
- "myst-common": "^0.0.16",
26
- "myst-config": "^0.0.14",
27
- "myst-demo": "^0.2.9",
28
- "myst-to-react": "^0.2.9",
25
+ "myst-common": "^1.0.0",
26
+ "myst-config": "^1.0.0",
27
+ "myst-demo": "^0.3.0",
28
+ "myst-to-react": "^0.3.0",
29
29
  "nbtx": "^0.2.3",
30
30
  "node-cache": "^5.1.2",
31
31
  "node-fetch": "^2.6.7",
32
- "unist-util-select": "^4.0.1",
33
- "thebe-react": "^0.0.7"
32
+ "thebe-react": "^0.0.7",
33
+ "unist-util-select": "^4.0.1"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@remix-run/node": "^1.12.0",
@@ -4,7 +4,13 @@ import ArrowRightIcon from '@heroicons/react/24/outline/ArrowRightIcon';
4
4
  import type { FooterLinks, NavigationLink } from '../types';
5
5
  import { useLinkProvider, useBaseurl, withBaseurl } from '@myst-theme/providers';
6
6
 
7
- const FooterLink = ({ title, url, group, right }: NavigationLink & { right?: boolean }) => {
7
+ const FooterLink = ({
8
+ title,
9
+ short_title,
10
+ url,
11
+ group,
12
+ right,
13
+ }: NavigationLink & { right?: boolean }) => {
8
14
  const baseurl = useBaseurl();
9
15
  const Link = useLinkProvider();
10
16
  return (
@@ -15,14 +21,14 @@ const FooterLink = ({ title, url, group, right }: NavigationLink & { right?: boo
15
21
  >
16
22
  <div className="flex align-middle h-full">
17
23
  {right && (
18
- <ArrowLeftIcon className="w-6 h-6 self-center transition-transform group-hover:-translate-x-1" />
24
+ <ArrowLeftIcon className="w-6 h-6 self-center transition-transform group-hover:-translate-x-1 shrink-0" />
19
25
  )}
20
26
  <div className={classNames('flex-grow', { 'text-right': right })}>
21
27
  <div className="text-xs text-gray-500 dark:text-gray-400">{group || ' '}</div>
22
- {title}
28
+ {short_title || title}
23
29
  </div>
24
30
  {!right && (
25
- <ArrowRightIcon className="w-6 h-6 self-center transition-transform group-hover:translate-x-1" />
31
+ <ArrowRightIcon className="w-6 h-6 self-center transition-transform group-hover:translate-x-1 shrink-0" />
26
32
  )}
27
33
  </div>
28
34
  </Link>
@@ -185,7 +185,7 @@ export const TableOfContents = ({
185
185
  >
186
186
  <nav
187
187
  aria-label="Table of Contents"
188
- className="flex-grow overflow-y-auto transition-opacity mt-6 pb-3 ml-3 xl:ml-0 mr-3"
188
+ className="flex-grow overflow-y-auto transition-opacity mt-6 pb-3 ml-3 xl:ml-0 mr-3 max-w-[350px]"
189
189
  >
190
190
  <Headings folder={projectSlug} headings={headings} sections={config?.projects} />
191
191
  </nav>
@@ -32,6 +32,7 @@ export function getProjectHeadings(
32
32
  const headings: Heading[] = [
33
33
  {
34
34
  title: project.title,
35
+ short_title: project.short_title,
35
36
  slug: project.index,
36
37
  path: project.slug ? `/${project.slug}` : '/',
37
38
  level: 'index',
@@ -42,10 +43,10 @@ export function getProjectHeadings(
42
43
  }),
43
44
  ];
44
45
  if (opts.addGroups) {
45
- let lastTitle = project.title;
46
+ let lastTitle = project.short_title || project.title;
46
47
  return headings.map((heading) => {
47
48
  if (!heading.slug || heading.level === 'index') {
48
- lastTitle = heading.title;
49
+ lastTitle = heading.short_title || heading.title;
49
50
  }
50
51
  return { ...heading, group: lastTitle };
51
52
  });
@@ -60,6 +61,7 @@ function getHeadingLink(currentSlug: string, headings?: Heading[]): NavigationLi
60
61
  if (!link?.path) return undefined;
61
62
  return {
62
63
  title: link.title,
64
+ short_title: link.short_title,
63
65
  url: link.path,
64
66
  group: link.group,
65
67
  };
@@ -70,7 +72,7 @@ export function getFooterLinks(
70
72
  projectSlug?: string,
71
73
  slug?: string,
72
74
  ): FooterLinks {
73
- if (!projectSlug || !slug || !config) return {};
75
+ if (!slug || !config) return {};
74
76
  const pages = getProjectHeadings(config, projectSlug, {
75
77
  addGroups: true,
76
78
  });
package/src/types.ts CHANGED
@@ -25,6 +25,7 @@ export type NavigationLink = {
25
25
  group?: string;
26
26
  title: string;
27
27
  url: string;
28
+ short_title?: string;
28
29
  };
29
30
 
30
31
  export type FooterLinks = {