Skip to content

Commit d349efe

Browse files
authored
Merge pull request #97 from UW-Macrostrat/story-github-links
Storybook quality-of-life improvements
2 parents 3b82289 + f05425a commit d349efe

File tree

10 files changed

+103
-6
lines changed

10 files changed

+103
-6
lines changed

.storybook/main.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ import type { StorybookConfig } from "@storybook/react-vite";
33
export default {
44
// vite
55
stories: [
6-
"../stories/**/*.@(mdx|js|jsx|ts|tsx)",
6+
"../stories/**/*.mdx",
7+
"../stories/**/*.stories.@(mdx|js|jsx|ts|tsx)",
78
"../packages/*/src/**/*.mdx",
8-
"../packages/*/stories/*.mdx",
9+
"../packages/*/stories/**/*.mdx",
910
"../packages/**/*.stories.@(mdx|js|jsx|ts|tsx)",
1011
],
1112
addons: [
1213
"@storybook/addon-links",
1314
"@storybook/addon-essentials",
1415
"@storybook/addon-viewport",
1516
"storybook-dark-mode",
17+
"@kemuridama/storybook-addon-github",
1618
],
1719
framework: "@storybook/react-vite",
1820
docs: {},

.storybook/manager-head.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,23 @@
11
<meta name="darkreader-lock" />
2+
<link rel="shortcut icon" href="/favicon.ico" />
3+
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32" />
4+
<link
5+
href="https://fonts.googleapis.com/css?family=Maven+Pro&text=Macrostrat"
6+
rel="stylesheet"
7+
type="text/css"
8+
/>
9+
<style type="text/css">
10+
.page-title {
11+
font-family: "Maven Pro", sans-serif;
12+
font-size: 2em;
13+
font-weight: 600;
14+
display: flex;
15+
flex-direction: row;
16+
align-items: center;
17+
gap: 0.5em;
18+
}
19+
20+
a[title="GitHub"] {
21+
color: inherit;
22+
}
23+
</style>

.storybook/preview.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export const parameters = {
3939
storySort: {
4040
order: [
4141
"Web components",
42+
"Example story",
4243
"Map interface",
4344
"Column views",
4445
"Timescale",
@@ -47,6 +48,10 @@ export const parameters = {
4748
},
4849
},
4950
},
51+
github: {
52+
repository: "UW-Macrostrat/web-components",
53+
branch: "main",
54+
},
5055
};
5156

5257
export const decorators = [
@@ -64,7 +69,7 @@ export const tags = ["autodocs"];
6469
function PatternProvider({ children }) {
6570
return h(GeologicPatternProvider, {
6671
resolvePattern(id: string) {
67-
return `https://dev2.macrostrat.org/assets/geologic-patterns/svg/${id}.svg`;
72+
return `https://dev.macrostrat.org/assets/geologic-patterns/svg/${id}.svg`;
6873
},
6974
children,
7075
});

.storybook/theme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { create } from "@storybook/theming";
22

33
export default create({
44
base: "light",
5-
brandTitle: `<img src="https://macrostrat.org/img/logo_red.png" width="16px" height="16px"/>&nbsp;Macrostrat`,
5+
brandTitle: `<h1 class="page-title"><img src="https://storage.macrostrat.org/assets/web/macrostrat-icons/macrostrat-icon.svg" width="36px" height="36px"/><span>Macrostrat</span></h1>`,
66
brandUrl: "https://macrostrat.org",
77
brandTarget: "_self",
88
});

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
],
7676
"packageManager": "[email protected]",
7777
"devDependencies": {
78+
"@kemuridama/storybook-addon-github": "^1.4.0",
7879
"@parcel/packager-ts": "^2.14.4",
7980
"@types/d3-array": "^3.2.1",
8081
"@types/underscore": "^1.13.0",

public/favicon-32x32.png

704 Bytes
Loading

public/favicon.ico

3.55 KB
Binary file not shown.

stories/Web components.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import pkg from "../packages/map-interface/package.json";
1+
import { PackageInfo } from "./package-info";
22

33
# Macrostrat web components
44

@@ -8,4 +8,4 @@ rendering geologic information. They are heavily used in
88
[Rockd](https://rockd.org), and other applications for authoring and exploring
99
information about the Earth's crust.
1010

11-
<code>{pkg.name}</code>: <code>{pkg.version}</code>
11+
<PackageInfo></PackageInfo>

stories/package-info.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import h from "@macrostrat/hyper";
2+
3+
const packages = [
4+
"ui-components",
5+
"map-interface",
6+
"timescale",
7+
"api-types",
8+
"color-utils",
9+
"column-components",
10+
"column-creator",
11+
"column-views",
12+
"cross-section-utils",
13+
"data-components",
14+
"data-sheet",
15+
"feedback-components",
16+
"form-components",
17+
"map-styles",
18+
"mapbox-react",
19+
"mapbox-utils",
20+
"stratigraphy-utils",
21+
"style-system",
22+
"svg-map-components",
23+
];
24+
25+
export function PackageInfo() {
26+
return h(
27+
"ul.package-info",
28+
packages.map((pkg) => {
29+
return h("li.package-info-item", [
30+
h("code.bp5-code.package-name", "@macrostrat/" + pkg),
31+
" ",
32+
h("span.links", [
33+
h(
34+
"a",
35+
{
36+
href: `https://github.com/UW-Macrostrat/web-components/blob/main/packages/${pkg}`,
37+
target: "_blank",
38+
},
39+
"Github"
40+
),
41+
", ",
42+
h(
43+
"a",
44+
{
45+
href: `https://npmjs.org/package/@macrostrat/${pkg}`,
46+
target: "_blank",
47+
},
48+
"NPM"
49+
),
50+
]),
51+
]);
52+
})
53+
);
54+
}

yarn.lock

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,6 +2117,18 @@ __metadata:
21172117
languageName: node
21182118
linkType: hard
21192119

2120+
"@kemuridama/storybook-addon-github@npm:^1.4.0":
2121+
version: 1.4.0
2122+
resolution: "@kemuridama/storybook-addon-github@npm:1.4.0"
2123+
peerDependencies:
2124+
"@storybook/components": ^7 || ^8
2125+
"@storybook/icons": ^1
2126+
"@storybook/manager-api": ^7 || ^8
2127+
react: ^17 || ^18 || ^19
2128+
checksum: 10c0/ab27a3c7ba8edc7baadf7ecab2ab1f54d47d66f02941b55eb5a52dca514f844369b5ee296874e73b8bb369c4e134d52571d83ab40a2ad0e358c1d7878d4df087
2129+
languageName: node
2130+
linkType: hard
2131+
21202132
"@lezer/common@npm:^1.0.0":
21212133
version: 1.2.3
21222134
resolution: "@lezer/common@npm:1.2.3"
@@ -2626,6 +2638,7 @@ __metadata:
26262638
"@babel/preset-env": "npm:^7.21.4"
26272639
"@babel/preset-typescript": "npm:^7.21.4"
26282640
"@blueprintjs/core": "npm:^5.10.2"
2641+
"@kemuridama/storybook-addon-github": "npm:^1.4.0"
26292642
"@macrostrat/hyper": "npm:^3.0.6"
26302643
"@parcel/bundler-library": "npm:^2.14.4"
26312644
"@parcel/config-default": "npm:^2.14.4"

0 commit comments

Comments
 (0)