Skip to content

Commit 6a13f9f

Browse files
authored
feat: add Storybook manager config and improve component previews (#3)
This release introduces improvements to Storybook setup and accessibility fixes. fix(DualScrollSync): add title attribute for better accessibility fix(DualScrollSync): refine nav item styles and active indicator perf(storybook): update stories with new mock data (internal only) ci: add workflow for npm publishing chore: update release-please config chore: rename changelog-types to changelog-sections
1 parent b8459ac commit 6a13f9f

10 files changed

Lines changed: 235 additions & 200 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
jobs:
9+
release-please:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: google-github-actions/release-please-action@v4
13+
with:
14+
token: ${{ secrets.GITHUB_TOKEN }}
15+
release-type: node

.github/workflows/release.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
name: Release to npm
22

33
on:
4-
push:
5-
tags:
6-
- 'v*.*.*'
7-
workflow_dispatch:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
89

910
jobs:
1011
publish:
@@ -17,6 +18,8 @@ jobs:
1718
steps:
1819
- name: Checkout
1920
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
2023

2124
- name: Setup pnpm
2225
uses: pnpm/action-setup@v4
@@ -26,25 +29,30 @@ jobs:
2629
with:
2730
node-version: 20
2831
registry-url: 'https://registry.npmjs.org'
32+
always-auth: true
2933
cache: 'pnpm'
3034

3135
- name: Install
3236
run: pnpm install --frozen-lockfile
3337

3438
- name: Test
35-
run: pnpm test
39+
run: pnpm test --if-present
3640

3741
- name: Build
3842
run: pnpm run build
3943

4044
- name: Verify tag matches package.json version
4145
run: |
4246
PKG_VERSION=$(node -p "require('./package.json').version")
43-
TAG_VERSION=${GITHUB_REF#refs/tags/v}
44-
echo "package.json: $PKG_VERSION | tag: $TAG_VERSION"
45-
[ "$PKG_VERSION" = "$TAG_VERSION" ] || { echo "❌ Tag and package.json version mismatch"; exit 1; }
47+
RAW_TAG="${{ github.event.release.tag_name }}"
48+
TAG_VERSION="${RAW_TAG#v}"
49+
echo "package.json: $PKG_VERSION | tag: $RAW_TAG (-> $TAG_VERSION)"
50+
if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
51+
echo "❌ Tag and package.json version mismatch"
52+
exit 1
53+
fi
4654
4755
- name: Publish to npm
48-
run: npm publish --provenance
56+
run: npm publish --provenance --access public
4957
env:
5058
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "1.1.2"
3+
}

.storybook/manager.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { addons } from 'storybook/manager-api';
2+
import { create } from 'storybook/theming';
3+
4+
import { version } from '../package.json';
5+
6+
const theme = create({
7+
base: 'light',
8+
brandTitle: `React Dual Scroll Sync v${version}`,
9+
brandUrl: 'https://github.com/dorixdev/react-dual-scroll-sync',
10+
colorSecondary: '#222831'
11+
});
12+
13+
addons.setConfig({
14+
theme,
15+
panelPosition: 'right'
16+
});

.storybook/preview.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import type { Preview } from '@storybook/react-vite';
22

33
const preview: Preview = {
44
parameters: {
5-
chromatic: { pauseAnimationAtEnd: true, delay: 400 },
6-
actions: { argTypesRegex: '^on[A-Z].*' },
7-
controls: { matchers: { color: /(background|color)$/i, date: /Date$/i } }
5+
layout: 'centered',
6+
viewport: { disable: true }
87
},
98
tags: ['autodocs']
109
};

lib/components/DualScrollSync/DualScrollSync.module.scss

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
width: 100%;
3434
height: calc(100% / var(--menu-nav-visible-count));
35-
min-height: 56px;
3635
padding: var(--dual-scroll-sync-space-m, #{$space-m}) var(--dual-scroll-sync-space-s, #{$space-s});
3736
border: none;
3837
border-bottom: 1px solid var(--dual-scroll-sync-border-color, #{$border-color});
@@ -63,12 +62,8 @@
6362
}
6463

6564
.scrollSyncNavItemLabel {
66-
display: flex;
67-
align-items: center;
68-
69-
height: 100%;
65+
margin: auto 0;
7066
padding: 0 var(--dual-scroll-sync-space-m, #{$space-m});
71-
7267
font-size: smaller;
7368
}
7469

@@ -78,13 +73,24 @@
7873
}
7974

8075
.scrollSyncNavItemActive {
76+
position: relative;
8177
background-color: var(--dual-scroll-sync-background-color, #{$highlight-background-color});
8278

8379
span {
84-
border-left: 3px solid
85-
var(--dual-scroll-sync-highlight-foreground-color, #{$highlight-foreground-color});
8680
font-weight: bold;
8781
color: var(--dual-scroll-sync-highlight-foreground-color, #{$highlight-foreground-color});
82+
83+
&::before {
84+
content: '';
85+
86+
position: absolute;
87+
top: 0;
88+
left: 0;
89+
90+
height: 100%;
91+
border-left: 4px solid
92+
var(--dual-scroll-sync-highlight-foreground-color, #{$highlight-foreground-color});
93+
}
8894
}
8995
}
9096

lib/components/DualScrollSync/DualScrollSync.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ DualScrollSync.ContentSection = forwardRef<HTMLElement, DualScrollSyncContentSec
118118
id={contentSectionId}
119119
ref={ref}
120120
>
121-
<span className={styles.scrollSyncContentSectionLabel}>{label}</span>
121+
<span className={styles.scrollSyncContentSectionLabel} title={label}>
122+
{label}
123+
</span>
122124
{children}
123125
</article>
124126
);

0 commit comments

Comments
 (0)