Skip to content

Commit

Permalink
docs(Zeroheight): fix SVG loader script to display BEEQ icons in the …
Browse files Browse the repository at this point in the history
…code preview
  • Loading branch information
dgonzalezr committed Dec 18, 2024
1 parent f73edaa commit 4a1e2b4
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 8 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Update Storybook (via GitHub Pages)

on: workflow_dispatch

env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

permissions:
contents: read
pages: write
id-token: write

jobs:
main:
name: 📘 Storybook deploy
runs-on: ubuntu-latest
env:
NX_BRANCH: ${{ github.head_ref || github.ref_name }}
steps:
- name: 🛎 Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 🛠 Setup Volta
uses: volta-cli/action@v4

- name: 🚚 Deploy BEEQ Storybook to GitHub Pages
uses: bitovi/github-actions-storybook-to-github-pages@v1.0.3
with:
build_command: npm run build
checkout: false
install_command: npm ci
path: ./dist/storybook/beeq
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 1.8.1 (2024-12-18)
## [1.8.1](https://github.com/Endava/BEEQ/compare/v1.8.0...v1.8.1) (2024-12-18)

### Chore ⚙️

Expand Down
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"namedInputs": {
"default": [
"{projectRoot}/**/*",
"{workspaceRoot}/config/**/*",
"{workspaceRoot}/nx.json",
"{workspaceRoot}/package.json",
"{workspaceRoot}/tailwind.config.ts"
],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "beeq",
"version": "1.8.0",
"version": "1.8.1",
"description": "BEEQ Design System",
"license": "Apache-2.0",
"private": true,
Expand Down
11 changes: 6 additions & 5 deletions packages/beeq/src/global/scripts/zeroheight-svg-loader.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
/**
* @see: https://share.cleanshot.com/zvXbCj2b
* Currently there's an issue that avoid loading external assets on Zeroheight.
* This file will allow loading SVG assets from `@beeq/core/dist/beeq/svg` folder inside the code preview.
* This file will allow loading SVG assets from a CDN inside the code preview.
*/

const proxyFetch = {
apply(target, _thisArg, args) {
if (args[0].startsWith('/svg/')) {
return import(`./node_modules/@beeq/core/dist/beeq${args[0]}`).then(
(e) => new Response(atob(e.default.replace('data:image/svg+xml;base64,', ''))),
);
const svgUrl = args[0];
if (svgUrl.includes('/svg/')) {
const svgName = svgUrl.substring(svgUrl.lastIndexOf('/') + 1);
const newUrl = `https://cdn.jsdelivr.net/npm/@beeq/core/dist/beeq/svg/${svgName}`;
return target(newUrl, args[1], args[2]);
}
return target(...args);
},
Expand Down

0 comments on commit 4a1e2b4

Please sign in to comment.