From 53299ce8295ccab6b618cd2f1b7cb0e4a54e6726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Pess=C3=A9?= Date: Fri, 2 Feb 2024 10:16:15 +0100 Subject: [PATCH] Add support for straight corners (#131) * Add class to body and tailwind variant * Use it on the search button * Use it for buttons and cookies banner * Use it for cards * Use it in more places * Lint * More * page feedback * theme toggler --- src/app/[spaceId]/layout.tsx | 23 +++++++++++++------ src/components/Cookies/CookiesToast.tsx | 1 + src/components/DocumentView/Caption.tsx | 2 ++ src/components/DocumentView/Hint.tsx | 1 + .../DocumentView/Table/RecordCard.tsx | 2 ++ src/components/Header/Dropdown.tsx | 2 ++ src/components/Header/HeaderLogo.tsx | 1 + src/components/Header/HeaderMobileMenu.tsx | 1 + .../PageBody/PageFooterNavigation.tsx | 1 + .../PageFeedback/PageFeedbackForm.tsx | 3 +++ src/components/Search/SearchButton.tsx | 1 + .../TableOfContents/PageLinkItem.tsx | 1 + .../TableOfContents/ToggleableLinkItem.tsx | 2 ++ src/components/TableOfContents/Trademark.tsx | 1 + src/components/ThemeToggler/ThemeToggler.tsx | 2 ++ src/components/primitives/Button.tsx | 1 + src/components/primitives/Card.tsx | 1 + tailwind.config.ts | 5 ++++ 18 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/app/[spaceId]/layout.tsx b/src/app/[spaceId]/layout.tsx index ab3f59f59..b7f7cfa4c 100644 --- a/src/app/[spaceId]/layout.tsx +++ b/src/app/[spaceId]/layout.tsx @@ -1,4 +1,8 @@ -import { CustomizationHeaderPreset, CustomizationSettings } from '@gitbook/api'; +import { + CustomizationCorners, + CustomizationHeaderPreset, + CustomizationSettings, +} from '@gitbook/api'; import assertNever from 'assert-never'; import colors from 'tailwindcss/colors'; @@ -81,12 +85,17 @@ export default async function SpaceRootLayout(props: { `} ) { 'py-4', 'transition-colors', 'rounded-md', + 'straight-corners:rounded-none', hintStyle.style, style, )} diff --git a/src/components/DocumentView/Table/RecordCard.tsx b/src/components/DocumentView/Table/RecordCard.tsx index 6be167959..c69b57cd5 100644 --- a/src/components/DocumentView/Table/RecordCard.tsx +++ b/src/components/DocumentView/Table/RecordCard.tsx @@ -41,6 +41,7 @@ export async function RecordCard( 'h-[calc(100%+2px)]', 'inset-[-1px]', 'rounded-[7px]', + 'straight-corners:rounded-none', 'overflow-hidden', 'dark:bg-dark', )} @@ -97,6 +98,7 @@ export async function RecordCard( 'shadow-1xs', 'shadow-dark/[0.02]', 'rounded-md', + 'straight-corners:rounded-none', 'hover:before:ring-dark/4', 'dark:shadow-transparent', 'dark:hover:before:ring-light/4', diff --git a/src/components/Header/Dropdown.tsx b/src/components/Header/Dropdown.tsx index a83652ca6..5c4188a76 100644 --- a/src/components/Header/Dropdown.tsx +++ b/src/components/Header/Dropdown.tsx @@ -55,6 +55,7 @@ export function Dropdown(props: { 'max-h-56', 'bg-light', 'rounded-lg', + 'straight-corners:rounded-sm', 'p-2', 'shadow-1xs', 'overflow-auto', @@ -121,6 +122,7 @@ export function DropdownMenuItem(props: { 'px-3', 'py-1', 'rounded', + 'straight-corners:rounded-sm', active ? ['bg-primary/3', 'dark:bg-light/2', 'text-primary-600'] : ['hover:bg-dark/2', 'dark:hover:bg-light/2'], diff --git a/src/components/Header/HeaderLogo.tsx b/src/components/Header/HeaderLogo.tsx index 754061bc1..69b27fd09 100644 --- a/src/components/Header/HeaderLogo.tsx +++ b/src/components/Header/HeaderLogo.tsx @@ -62,6 +62,7 @@ export function HeaderLogo(props: HeaderLogoProps) { 'lg:max-w-[12rem]', 'max-h-[3rem]', 'rounded', + 'straight-corners:rounded-sm', 'overflow-hidden', 'object-contain', 'object-left', diff --git a/src/components/Header/HeaderMobileMenu.tsx b/src/components/Header/HeaderMobileMenu.tsx index c98644135..e2d07d351 100644 --- a/src/components/Header/HeaderMobileMenu.tsx +++ b/src/components/Header/HeaderMobileMenu.tsx @@ -59,6 +59,7 @@ export function HeaderMobileMenu(props: Partial*:last-child]:rounded-r-full', '[&>*:first-child]:rounded-l-full', + 'straight-corners:[&>*:last-child]:rounded-none', + 'straight-corners:[&>*:first-child]:rounded-none', )} >