From ad224732cc924e93c8c26f369e0c48aed484d8dd Mon Sep 17 00:00:00 2001 From: Oleg Isonen Date: Fri, 5 Jan 2024 12:51:47 +0100 Subject: [PATCH] feat: Link typography tokens and a new Link component in DS (#2729) ## Description - Decided to not have separate colors for link, it should just use regular text colors. - Added a Link component to the design system, modelled after MUI Link component ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env.example` and the `builder/env-check.js` if mandatory --------- Co-authored-by: Taylor Nowotny <86495896+taylornowotny@users.noreply.github.com> Co-authored-by: Bot (build-figma-tokens.yml) Co-authored-by: Bogdan Chadkin --- .../blocking-alerts/blocking-alerts.tsx | 44 +++--- .../app/builder/features/topbar/publish.tsx | 36 +++-- .../app/dashboard/projects/project-card.tsx | 21 +-- .../__generated__/figma-design-tokens.json | 134 +++++++++++------- .../src/__generated__/figma-design-tokens.ts | 98 +++++++++---- .../src/components/input-field.stories.tsx | 6 + .../src/components/input-field.tsx | 41 ++++-- .../src/components/link.stories.tsx | 79 +++++++++++ .../design-system/src/components/link.tsx | 65 +++++++++ .../src/components/text-area.stories.tsx | 5 + .../src/components/text-area.tsx | 25 +++- packages/design-system/src/index.ts | 1 + 12 files changed, 416 insertions(+), 139 deletions(-) create mode 100644 packages/design-system/src/components/link.stories.tsx create mode 100644 packages/design-system/src/components/link.tsx diff --git a/apps/builder/app/builder/features/blocking-alerts/blocking-alerts.tsx b/apps/builder/app/builder/features/blocking-alerts/blocking-alerts.tsx index 880fbd3618e3..a12ebf93416a 100644 --- a/apps/builder/app/builder/features/blocking-alerts/blocking-alerts.tsx +++ b/apps/builder/app/builder/features/blocking-alerts/blocking-alerts.tsx @@ -2,7 +2,7 @@ import { useEffect, useState, type ReactNode } from "react"; import { Alert } from "./alert"; import { useWindowResizeDebounced } from "~/shared/dom-hooks"; import { isFeatureEnabled } from "@webstudio-is/feature-flags"; -import { styled, theme } from "@webstudio-is/design-system"; +import { Link } from "@webstudio-is/design-system"; const useTooSmallMessage = () => { const [message, setMessage] = useState(); @@ -21,21 +21,11 @@ const useTooSmallMessage = () => { return message; }; -// @todo: move to design system -// https://discord.com/channels/955905230107738152/1149380442315825212/1149408306671128666 -// https://discord.com/channels/955905230107738152/1048308525673238558/1184833931569266738 -const Link = styled("a", { - color: theme.colors.foregroundLink, - "&:visited": { - color: theme.colors.foregroundLinkVisited, - }, -}); - const useUnsupportedBrowser = () => { const [message, setMessage] = useState(); useEffect(() => { if ("chrome" in window || isFeatureEnabled("unsupportedBrowsers")) { - return; + //return; } setMessage( @@ -44,23 +34,45 @@ const useUnsupportedBrowser = () => { Chromium-based {" "} browsers such as{" "} - + Google Chrome ,{" "} - + Microsoft Edge ,{" "} - + Brave ,{" "} - + Arc {" "} and many more. We plan to support Firefox and Safari in the near future. diff --git a/apps/builder/app/builder/features/topbar/publish.tsx b/apps/builder/app/builder/features/topbar/publish.tsx index 0bfc6667f32a..ab074e96e7df 100644 --- a/apps/builder/app/builder/features/topbar/publish.tsx +++ b/apps/builder/app/builder/features/topbar/publish.tsx @@ -19,10 +19,10 @@ import { ScrollArea, Box, rawTheme, - styled, Select, theme, TextArea, + Link, } from "@webstudio-is/design-system"; import stripIndent from "strip-indent"; import { useIsPublishDialogOpen } from "../../shared/nano-states"; @@ -187,6 +187,7 @@ const ChangeProjectDomain = ({ { Download and install Node v18+ from{" "} - + nodejs.org {" "} or with{" "} { - +