From 8f6ed578b36ca0f2800d26e6be2d7f496ef47082 Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Mon, 7 Oct 2024 15:35:45 -0400 Subject: [PATCH 1/8] Added a stub overview page for the whole storybook. --- stories/Overview.mdx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 stories/Overview.mdx diff --git a/stories/Overview.mdx b/stories/Overview.mdx new file mode 100644 index 0000000..abebe17 --- /dev/null +++ b/stories/Overview.mdx @@ -0,0 +1,18 @@ +# Overview: Polis-Storybook + +🚧 This overview page is considered a work-in-progress until this line is removed + +TODO: Summarize the structure, goals, and affiliations of this initiative. + +## Goals +- Make accessibility reviews and improvements of Polis interfaces easier +- Allow UI/UX desigers to more easily contribute and explore Polis UI changes without deploying the whole Polis application +- Allow more sharing of Polis UI variants from forks of Polis +- Support Polis practitioners in carrying out more UI explorations and experiments +- Help Polis practitioners to evolve their own hosted instances of the platform + +This is a project of the Polis Toronto breakout group ([notes][]), +incubated within the [Civic Tech Toronto][] community. + + [notes]: https://link.civictech.ca/polis + [Civic Tech Toronto]: https://civictech.ca/ From 4c127be8ecc292bec0e7b63f6309bb22e76c0d9c Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Mon, 7 Oct 2024 18:51:34 -0400 Subject: [PATCH 2/8] Testing to get pathname's working for branch switcher. --- .storybook/preview.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.storybook/preview.js b/.storybook/preview.js index 6731af8..2d821eb 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -1,6 +1,9 @@ /** @type { import('@storybook/react').Preview } */ const preview = { parameters: { + branches: { + hostname: "127.0.0.1:8080/storybook-bundle", + }, controls: { matchers: { color: /(background|color)$/i, From c5dbaf42b32de5fbe18032b7d49e349c451ea6bf Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Mon, 7 Oct 2024 19:26:10 -0400 Subject: [PATCH 3/8] Added smartness to preview.js to detect github builds and prepare for pages deploy properly. --- .storybook/main.js | 4 ++++ .storybook/preview.js | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/.storybook/main.js b/.storybook/main.js index 4a94895..5dbcedf 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -17,5 +17,9 @@ const config = { name: "@storybook/react-webpack5", options: {}, }, + env: (config) => ({ + ...config, + GITHUB_REPOSITORY: process.env["GITHUB_REPOSITORY"], + }), }; export default config; diff --git a/.storybook/preview.js b/.storybook/preview.js index 2d821eb..acc5543 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -1,4 +1,5 @@ /** @type { import('@storybook/react').Preview } */ +const isGithubBuild = !!process.env["GITHUB_REPOSITORY"] const preview = { parameters: { branches: { @@ -13,4 +14,11 @@ const preview = { }, }; +if (true) { + const [owner, repo] = process.env["GITHUB_REPOSITORY"].split("/") + preview.parameters["branches"] = { + hostname: `${owner}.github.io/${repo}`, + } +} + export default preview; From d200646e96bc518e62ae29ee04b2ce2cb633a6e9 Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Mon, 7 Oct 2024 19:43:04 -0400 Subject: [PATCH 4/8] Avoid default_root to side-step issue with redirecting back to root from branch instances. --- .storybook/.branches.json | 2 +- .storybook/main.js | 2 +- .storybook/preview.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.storybook/.branches.json b/.storybook/.branches.json index abbed7e..aad718f 100644 --- a/.storybook/.branches.json +++ b/.storybook/.branches.json @@ -3,7 +3,7 @@ "to": "dist/storybook-bundle", "script_name": "build-storybook-branch", "default_branch": "main", - "default_root": true, + "default_root": false, "provider": { "type": "github", "owner": "CivicTechTO", diff --git a/.storybook/main.js b/.storybook/main.js index 5dbcedf..1c12820 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -19,7 +19,7 @@ const config = { }, env: (config) => ({ ...config, - GITHUB_REPOSITORY: process.env["GITHUB_REPOSITORY"], + GITHUB_REPOSITORY: process.env["GITHUB_REPOSITORY"] || null, }), }; export default config; diff --git a/.storybook/preview.js b/.storybook/preview.js index acc5543..7363c5e 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -14,7 +14,7 @@ const preview = { }, }; -if (true) { +if (isGithubBuild) { const [owner, repo] = process.env["GITHUB_REPOSITORY"].split("/") preview.parameters["branches"] = { hostname: `${owner}.github.io/${repo}`, From a1e2780564dbb14f4df5e7b29eb54e8a1f6e53d0 Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Mon, 7 Oct 2024 20:26:32 -0400 Subject: [PATCH 5/8] Remove github deploy sending for now. --- .storybook/main.js | 4 ---- .storybook/preview.js | 8 -------- 2 files changed, 12 deletions(-) diff --git a/.storybook/main.js b/.storybook/main.js index 1c12820..4a94895 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -17,9 +17,5 @@ const config = { name: "@storybook/react-webpack5", options: {}, }, - env: (config) => ({ - ...config, - GITHUB_REPOSITORY: process.env["GITHUB_REPOSITORY"] || null, - }), }; export default config; diff --git a/.storybook/preview.js b/.storybook/preview.js index 7363c5e..2d821eb 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -1,5 +1,4 @@ /** @type { import('@storybook/react').Preview } */ -const isGithubBuild = !!process.env["GITHUB_REPOSITORY"] const preview = { parameters: { branches: { @@ -14,11 +13,4 @@ const preview = { }, }; -if (isGithubBuild) { - const [owner, repo] = process.env["GITHUB_REPOSITORY"].split("/") - preview.parameters["branches"] = { - hostname: `${owner}.github.io/${repo}`, - } -} - export default preview; From 3593817161477af448c96cfcb7c63ca8176ba81d Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Mon, 7 Oct 2024 21:13:41 -0400 Subject: [PATCH 6/8] Base to using main branch as default. --- .storybook/.branches.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.storybook/.branches.json b/.storybook/.branches.json index aad718f..abbed7e 100644 --- a/.storybook/.branches.json +++ b/.storybook/.branches.json @@ -3,7 +3,7 @@ "to": "dist/storybook-bundle", "script_name": "build-storybook-branch", "default_branch": "main", - "default_root": false, + "default_root": true, "provider": { "type": "github", "owner": "CivicTechTO", From 1d8e5a531e10a1fab2d314ca5e554226cc636805 Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Mon, 7 Oct 2024 19:26:10 -0400 Subject: [PATCH 7/8] Added smartness to preview.js to detect github builds and prepare for pages deploy properly. --- .storybook/main.js | 4 ++++ .storybook/preview.js | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/.storybook/main.js b/.storybook/main.js index 4a94895..1c12820 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -17,5 +17,9 @@ const config = { name: "@storybook/react-webpack5", options: {}, }, + env: (config) => ({ + ...config, + GITHUB_REPOSITORY: process.env["GITHUB_REPOSITORY"] || null, + }), }; export default config; diff --git a/.storybook/preview.js b/.storybook/preview.js index 2d821eb..7363c5e 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -1,4 +1,5 @@ /** @type { import('@storybook/react').Preview } */ +const isGithubBuild = !!process.env["GITHUB_REPOSITORY"] const preview = { parameters: { branches: { @@ -13,4 +14,11 @@ const preview = { }, }; +if (isGithubBuild) { + const [owner, repo] = process.env["GITHUB_REPOSITORY"].split("/") + preview.parameters["branches"] = { + hostname: `${owner}.github.io/${repo}`, + } +} + export default preview; From d967810b4bf1576428ad427652ebbb03ff4eb069 Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Mon, 7 Oct 2024 21:30:31 -0400 Subject: [PATCH 8/8] Removed localhost debug for multi-branch. --- .storybook/preview.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/.storybook/preview.js b/.storybook/preview.js index 7363c5e..6177e5b 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -2,9 +2,6 @@ const isGithubBuild = !!process.env["GITHUB_REPOSITORY"] const preview = { parameters: { - branches: { - hostname: "127.0.0.1:8080/storybook-bundle", - }, controls: { matchers: { color: /(background|color)$/i,