Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WEB-4082] 14.9.0 - Adopt TW theming, real SB dark mode, add TS declarations for scripts #546

Merged
merged 7 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .storybook/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,33 @@
var(--double) var(--double),
var(--double) var(--double);
}

.ui-theme-dark,
.ui-theme-dark .sbdocs {
@apply bg-neutral-1300;
}

.ui-theme-dark .sb-bar,
.ui-theme-dark .sb-anchor > p > code {
@apply bg-neutral-1200;
}

.ui-theme-dark .docblock-code-toggle {
@apply bg-neutral-1200 text-neutral-000;
}

.ui-theme-dark .sbdocs-content > *,
.ui-theme-dark .sb-anchor > h3,
.ui-theme-dark .sb-anchor > p,
.ui-theme-dark .sb-anchor > p > code {
@apply text-neutral-000;
}

.ui-theme-dark .sbdocs td,
.ui-theme-dark .sbdocs th {
@apply text-neutral-200;
}

.ui-theme-dark .sbdocs td {
@apply !bg-neutral-1100 text-neutral-200;
}
4 changes: 2 additions & 2 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ const preview = {
brandImage: brandImage,
},
stylePreview: true,
darkClass: ["bg-neutral-1300"],
lightClass: ["bg-neutral-000"],
darkClass: ["ui-theme-dark"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

lightClass: ["ui-theme-light"],
jamiehenson marked this conversation as resolved.
Show resolved Hide resolved
},
},
loaders: [mswLoader],
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ably/ui",
"version": "14.8.0",
"version": "14.9.0-dev.4cf104c",
"description": "Home of the Ably design system library ([design.ably.com](https://design.ably.com)). It provides a showcase, development/test environment and a publishing pipeline for different distributables.",
"repository": {
"type": "git",
Expand All @@ -15,6 +15,9 @@
"index.d.ts"
],
"types": "index.d.ts",
"msw": {
"workerDirectory": "./public"
},
"devDependencies": {
"@storybook/addon-a11y": "^8.4.0",
"@storybook/addon-essentials": "^8.4.0",
Expand Down Expand Up @@ -59,9 +62,8 @@
"build:swc": "swc src/core src/reset -d dist --copy-files --include-dotfiles --strip-leading-paths --config-file .swc --ignore **/*.stories.tsx,**/*.snap",
"build:tsc": "tsc && node tsc.js && rm -r types",
"build:cleanup": "mv dist/* . && rm -r dist",
"build:colors": "ts-node scripts/compute-colors.ts",
"build:sprites": "ts-node scripts/generate-sprites.ts",
"build": "yarn build:prebuild && yarn build:colors && yarn build:sprites && yarn build:swc && yarn build:tsc && yarn build:cleanup",
"build": "yarn build:prebuild && yarn build:sprites && yarn build:swc && yarn build:tsc && yarn build:cleanup",
"watch": "yarn build:swc -w",
"format:check": "prettier -c *.{js,ts} src/**/*.{js,ts,tsx}",
"format:write": "prettier -w *.{js,ts} src/**/*.{js,ts,tsx}",
Expand Down
15 changes: 12 additions & 3 deletions public/mockServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* - Please do NOT serve this file on production.
*/

const PACKAGE_VERSION = '2.3.4'
const INTEGRITY_CHECKSUM = '26357c79639bfa20d64c0efca2a87423'
const PACKAGE_VERSION = '2.6.1'
const INTEGRITY_CHECKSUM = '07a8241b182f8a246a7cd39894799a9e'
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
const activeClientIds = new Set()

Expand Down Expand Up @@ -62,7 +62,12 @@ self.addEventListener('message', async function (event) {

sendToClient(client, {
type: 'MOCKING_ENABLED',
payload: true,
payload: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my IDE is suggesting a warning: "Missing await for an async function call " what you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldnt worry about this file too much, it's an auto-generated asset from msw, which is the package we use to mock API responses in stories here - it's not shipped with the package

client: {
id: client.id,
frameType: client.frameType,
},
},
})
break
}
Expand Down Expand Up @@ -155,6 +160,10 @@ async function handleRequest(event, requestId) {
async function resolveMainClient(event) {
const client = await self.clients.get(event.clientId)

if (activeClientIds.has(event.clientId)) {
return client
}

if (client?.frameType === 'top-level') {
return client
}
Expand Down
81 changes: 0 additions & 81 deletions scripts/compute-colors.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`JS Components/Contact Footer Default smoke-test 1`] = `
>
<div class="w-full bp-lg max-w-screen-xl mx-auto py-64 grid grid-cols-1 md:grid-cols-3 ui-grid-gap ui-grid-px">
<div class="ui-contact-footer-box">
<svg class=" block mb-16"
<svg class="block mb-16"
style="width: 3rem; height: 3rem;"
>
<use xlink:href="#sprite-icon-display-live-chat">
Expand All @@ -31,7 +31,7 @@ exports[`JS Components/Contact Footer Default smoke-test 1`] = `
</button>
</div>
<div class="ui-contact-footer-box">
<svg class=" block mb-16"
<svg class="block mb-16"
style="width: 3rem; height: 3rem;"
>
<use xlink:href="#sprite-icon-display-call-mobile">
Expand All @@ -58,7 +58,7 @@ exports[`JS Components/Contact Footer Default smoke-test 1`] = `
</div>
</div>
<div class="ui-contact-footer-box">
<svg class=" block mb-16"
<svg class="block mb-16"
style="width: 3rem; height: 3rem;"
>
<use xlink:href="#sprite-icon-display-tech-account-comms">
Expand Down
2 changes: 1 addition & 1 deletion src/core/Expander/__snapshots__/Expander.stories.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ exports[`JS Components/Expander OverriddenControls play-test 1`] = `
>
<span class="flex items-center gap-8">
Away with you, knave.
<svg class="text-pink-500 "
<svg class="text-pink-500"
style="width: 24px; height: 24px;"
>
<use xlink:href="#sprite-icon-gui-warning">
Expand Down
4 changes: 2 additions & 2 deletions src/core/FeaturedLink.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React, { CSSProperties, ReactNode } from "react";

import Icon from "./Icon";
import { ColorClass } from "./styles/colors/types";
import { ColorClass, ColorThemeSet } from "./styles/colors/types";

type FeaturedLinkProps = {
url: string;
children: ReactNode;
textSize?: string;
iconColor?: ColorClass;
iconColor?: ColorClass | ColorThemeSet;
flush?: boolean;
reverse?: boolean;
additionalCSS?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`JS Components/Featured Link Default smoke-test 1`] = `
style="--featured-link-icon-size: var(--fs-p2);"
>
Featured link
<svg class=" align-middle ml-8 relative -top-1 -left-4 transition-[left] group-hover/featured-link:left-0"
<svg class="align-middle ml-8 relative -top-1 -left-4 transition-[left] group-hover/featured-link:left-0"
style="width: calc(var(--featured-link-icon-size) * 1.25); height: calc(var(--featured-link-icon-size) * 1.25);"
>
<use xlink:href="#sprite-icon-gui-link-arrow">
Expand All @@ -21,7 +21,7 @@ exports[`JS Components/Featured Link Disabled smoke-test 1`] = `
style="--featured-link-icon-size: var(--fs-p2);"
>
Featured link
<svg class=" align-middle ml-8 relative -top-1 -left-4 transition-[left] "
<svg class="align-middle ml-8 relative -top-1 -left-4 transition-[left] "
style="width: calc(var(--featured-link-icon-size) * 1.25); height: calc(var(--featured-link-icon-size) * 1.25);"
>
<use xlink:href="#sprite-icon-gui-link-arrow">
Expand All @@ -36,7 +36,7 @@ exports[`JS Components/Featured Link Large smoke-test 1`] = `
style="--featured-link-icon-size: var(--fs-p1);"
>
Featured link
<svg class=" align-middle ml-8 relative -top-1 -left-4 transition-[left] group-hover/featured-link:left-0"
<svg class="align-middle ml-8 relative -top-1 -left-4 transition-[left] group-hover/featured-link:left-0"
style="width: calc(var(--featured-link-icon-size) * 1.25); height: calc(var(--featured-link-icon-size) * 1.25);"
>
<use xlink:href="#sprite-icon-gui-link-arrow">
Expand Down Expand Up @@ -65,7 +65,7 @@ exports[`JS Components/Featured Link Reverse smoke-test 1`] = `
class="font-sans font-bold block text-gui-default hover:text-gui-hover focus:text-gui-focus focus:outline-gui-focus group/featured-link ui-text-p2 py-8 "
style="--featured-link-icon-size: var(--fs-p2);"
>
<svg class=" align-middle mr-8 relative -top-1 -right-4 transition-[right] group-hover/featured-link:right-0 transform rotate-180"
<svg class="align-middle mr-8 relative -top-1 -right-4 transition-[right] group-hover/featured-link:right-0 transform rotate-180"
style="width: calc(var(--featured-link-icon-size) * 1.25); height: calc(var(--featured-link-icon-size) * 1.25);"
>
<use xlink:href="#sprite-icon-gui-link-arrow">
Expand All @@ -81,7 +81,7 @@ exports[`JS Components/Featured Link Small smoke-test 1`] = `
style="--featured-link-icon-size: var(--fs-p3);"
>
Featured link
<svg class=" align-middle ml-8 relative -top-1 -left-4 transition-[left] group-hover/featured-link:left-0"
<svg class="align-middle ml-8 relative -top-1 -left-4 transition-[left] group-hover/featured-link:left-0"
style="width: calc(var(--featured-link-icon-size) * 1.25); height: calc(var(--featured-link-icon-size) * 1.25);"
>
<use xlink:href="#sprite-icon-gui-link-arrow">
Expand Down
12 changes: 6 additions & 6 deletions src/core/Footer/__snapshots__/Footer.stories.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ exports[`JS Components/Footer Default smoke-test 1`] = `
href="https://twitter.com/ablyrealtime"
title="Ably on X"
>
<svg class=" "
<svg class
style="width: 1.5rem; height: 1.5rem;"
>
<use xlink:href="#sprite-icon-social-x">
Expand All @@ -323,7 +323,7 @@ exports[`JS Components/Footer Default smoke-test 1`] = `
href="https://www.linkedin.com/company/ably-realtime"
title="Ably on LinkedIn"
>
<svg class=" "
<svg class
style="width: 1.5rem; height: 1.5rem;"
>
<use xlink:href="#sprite-icon-social-linkedin">
Expand All @@ -334,7 +334,7 @@ exports[`JS Components/Footer Default smoke-test 1`] = `
href="https://github.com/ably/"
title="Ably on Github"
>
<svg class=" "
<svg class
style="width: 1.5rem; height: 1.5rem;"
>
<use xlink:href="#sprite-icon-social-github">
Expand All @@ -345,7 +345,7 @@ exports[`JS Components/Footer Default smoke-test 1`] = `
href="https://discord.gg/jwBPhEZ9g5"
title="Ably on Discord"
>
<svg class=" "
<svg class
style="width: 1.5rem; height: 1.5rem;"
>
<use xlink:href="#sprite-icon-social-discord">
Expand All @@ -360,7 +360,7 @@ exports[`JS Components/Footer Default smoke-test 1`] = `
class="h-24 text-cool-black hover:text-icon-glassdoor"
title="Ably reviews on glassdoor"
>
<svg class=" "
<svg class
style="width: 1.5rem; height: 1.5rem;"
>
<use xlink:href="#sprite-icon-social-glassdoor">
Expand Down Expand Up @@ -388,7 +388,7 @@ exports[`JS Components/Footer Default smoke-test 1`] = `
href="https://www.glassdoor.co.uk/Overview/Working-at-Ably-EI_IE2184188.11,15.htm"
title="Ably reviews on glassdoor"
>
<svg class=" "
<svg class
style="width: 1.5rem; height: 1.5rem;"
>
<use xlink:href="#sprite-icon-social-glassdoor">
Expand Down
Loading
Loading