+
{noResultsMessage}
) : (
diff --git a/src/components/Search/SearchSectionResultItem.tsx b/src/components/Search/SearchSectionResultItem.tsx
index 2a308da51..3ddb7e2ff 100644
--- a/src/components/Search/SearchSectionResultItem.tsx
+++ b/src/components/Search/SearchSectionResultItem.tsx
@@ -19,24 +19,31 @@ export const SearchSectionResultItem = React.forwardRef(function SearchSectionRe
className={tcls(
'flex',
'flex-col',
- 'rounded',
- 'px-3',
- 'py-3',
'pl-6',
- 'hover:bg-slate-50',
+ 'hover:bg-dark/1',
active ? ['bg-primary-50'] : null,
)}
>
- {item.title ? (
-
-
-
- ) : null}
- {item.body ? (
-
-
-
- ) : null}
+
+ {item.title ? (
+
+
+
+ ) : null}
+ {item.body ? (
+
+
+
+ ) : null}
+
);
});
diff --git a/src/components/TableOfContents/PageDocumentItem.tsx b/src/components/TableOfContents/PageDocumentItem.tsx
index af640cd1a..377ef76c4 100644
--- a/src/components/TableOfContents/PageDocumentItem.tsx
+++ b/src/components/TableOfContents/PageDocumentItem.tsx
@@ -5,7 +5,7 @@ import { pageHref } from '@/lib/links';
import { tcls } from '@/lib/tailwind';
import { PagesList } from './PagesList';
-import { ToggeableLinkItem } from './ToggeableLinkItem';
+import { ToggleableLinkItem } from './ToggleableLinkItem';
export function PageDocumentItem(props: {
page: RevisionPageDocument;
@@ -29,28 +29,48 @@ export function PageDocumentItem(props: {
'transition-colors',
'duration-100',
activePage.id === page.id
- ? ['bg-primary-100', 'text-primary-500', 'font-semibold']
- : ['hover:bg-slate-100', 'text-slate-500', 'font-normal'],
+ ? [
+ 'font-semibold',
+ 'text-primary',
+ 'bg-primary-500/3',
+ 'dark:text-primary-400',
+ 'dark:hover:bg-primary-500/5',
+ ]
+ : [
+ 'font-normal',
+ 'text-dark/7',
+ 'hover:bg-dark/1',
+ 'dark:text-light/7',
+ 'dark:hover:bg-light/2',
+ ],
),
};
return (
{page.pages && page.pages.length ? (
-
}
defaultOpen={hasActiveDescendant || activePage.id === page.id}
+ isActive={activePage.id === page.id}
>
{page.title}
-
+
) : (
{page.title}
)}
diff --git a/src/components/TableOfContents/PageGroupItem.tsx b/src/components/TableOfContents/PageGroupItem.tsx
index 474dee94b..debc8698d 100644
--- a/src/components/TableOfContents/PageGroupItem.tsx
+++ b/src/components/TableOfContents/PageGroupItem.tsx
@@ -13,9 +13,7 @@ export function PageGroupItem(props: {
return (
-
- {page.title}
-
+ {page.title}
{page.pages && page.pages.length ? (
) : null}
diff --git a/src/components/TableOfContents/TableOfContents.tsx b/src/components/TableOfContents/TableOfContents.tsx
index b83eb5829..66c97a73c 100644
--- a/src/components/TableOfContents/TableOfContents.tsx
+++ b/src/components/TableOfContents/TableOfContents.tsx
@@ -30,8 +30,6 @@ export function TableOfContents(
'shrink-0',
'sticky',
withHeaderOffset ? SIDE_COLUMN_WITH_HEADER : SIDE_COLUMN_WITHOUT_HEADER,
- 'border-r',
- 'border-slate-200',
)}
>
{header ? {header}
: null}
diff --git a/src/components/TableOfContents/ToggeableLinkItem.tsx b/src/components/TableOfContents/ToggleableLinkItem.tsx
similarity index 69%
rename from src/components/TableOfContents/ToggeableLinkItem.tsx
rename to src/components/TableOfContents/ToggleableLinkItem.tsx
index b2b4f481c..19a333a8d 100644
--- a/src/components/TableOfContents/ToggeableLinkItem.tsx
+++ b/src/components/TableOfContents/ToggleableLinkItem.tsx
@@ -10,15 +10,16 @@ import { tcls } from '@/lib/tailwind';
/**
* Client component to allow toggling of a page's children.
*/
-export function ToggeableLinkItem(
+export function ToggleableLinkItem(
props: LinkProps & {
className?: string;
children: React.ReactNode;
descendants?: React.ReactNode;
defaultOpen?: boolean;
+ isActive?: boolean;
},
) {
- const { children, descendants, defaultOpen = false, ...linkProps } = props;
+ const { children, descendants, defaultOpen = false, isActive = false, ...linkProps } = props;
const [open, setOpen] = React.useState(defaultOpen);
const Chevron = open ? IconChevronDown : IconChevronRight;
@@ -32,10 +33,14 @@ export function ToggeableLinkItem(
'w-5',
'h-5',
'p-0.5',
- 'text-slate-600',
+ 'text-current',
'rounded',
- 'hover:bg-slate-200',
- 'hover:text-slate-700',
+ 'hover:bg-dark/2',
+ 'hover:text-current',
+ 'dark:hover:bg-light/2',
+ 'dark:hover:text-current',
+ 'transition-colors',
+ isActive ? ['hover:bg-primary-500/5', 'dark:hover:bg-primary-500/5'] : [],
)}
onClick={(event) => {
event.preventDefault();
diff --git a/src/components/TableOfContents/Trademark.tsx b/src/components/TableOfContents/Trademark.tsx
index 15edecbb1..9fdd0fb18 100644
--- a/src/components/TableOfContents/Trademark.tsx
+++ b/src/components/TableOfContents/Trademark.tsx
@@ -11,16 +11,19 @@ export function Trademark(props: IntlContext) {
href="https://www.gitbook.com"
className={tcls(
'text-m',
- 'text-slate-500',
+ 'text-dark/8',
'font-normal',
'px-4',
'py-3',
'mr-4',
'my-4',
'rounded-lg',
- 'bg-white',
- 'bg-slate-50',
- 'hover:bg-slate-100',
+ 'bg-dark/1',
+ 'hover:bg-dark/2',
+ 'transition-colors',
+ 'dark:bg-vanta/5',
+ 'dark:text-light/5',
+ 'dark:hover:bg-vanta/6',
)}
>
{t(props, 'powered_by_gitbook')}
diff --git a/src/components/ThemeToggler/ThemeToggler.tsx b/src/components/ThemeToggler/ThemeToggler.tsx
index 978e0175b..bde974cb0 100644
--- a/src/components/ThemeToggler/ThemeToggler.tsx
+++ b/src/components/ThemeToggler/ThemeToggler.tsx
@@ -52,10 +52,10 @@ export function ThemeToggler(props: IntlContext) {
className={tcls(
'flex',
'flex-row',
- 'rounded',
+ 'rounded-full',
'border',
- 'border-slate-200',
- 'dark:border-slate-800',
+ 'border-dark/3',
+ 'dark:border-light/2',
)}
>
-
+
);
}
diff --git a/src/components/utils/HexToRgb.tsx b/src/components/utils/HexToRgb.tsx
new file mode 100644
index 000000000..f0640ae5c
--- /dev/null
+++ b/src/components/utils/HexToRgb.tsx
@@ -0,0 +1,21 @@
+export function hexToRgb(hex: string): string {
+ // Remove the hash at the beginning of the hex string if it exists
+ let sanitizedHex = hex.replace('#', '');
+
+ // If the hex is shorthand (3 characters), expand it to 6 characters
+ if (sanitizedHex.length === 3) {
+ sanitizedHex = sanitizedHex
+ .split('')
+ .map((char) => char + char)
+ .join('');
+ }
+
+ // Convert the hex to an integer and extract the RGB components
+ const intVal = parseInt(sanitizedHex, 16);
+ const r = (intVal >> 16) & 255;
+ const g = (intVal >> 8) & 255;
+ const b = intVal & 255;
+
+ // Return the RGB values separated by spaces
+ return `${r} ${g} ${b}`;
+}
diff --git a/tailwind.config.ts b/tailwind.config.ts
index 077a72258..41350895d 100644
--- a/tailwind.config.ts
+++ b/tailwind.config.ts
@@ -1,11 +1,22 @@
import type { Config } from 'tailwindcss';
-const shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900];
+export const shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900];
+export const opacities = [4, 8, 12, 16, 24, 40, 64, 72, 88, 96];
function generateShades(varName: string) {
return shades.reduce(
(acc, shade) => {
- acc[shade] = `var(--${varName}-${shade})`;
+ acc[shade] = `rgb(var(--${varName}-${shade}) / )`;
+ return acc;
+ },
+ { DEFAULT: `rgb(var(--${varName}-500) / )` } as Record,
+ );
+}
+
+function opacity() {
+ return opacities.reduce(
+ (acc, opacity, index) => {
+ acc[index + 1] = `${opacity / 100}`;
return acc;
},
{} as Record,
@@ -24,10 +35,19 @@ const config: Config = {
colors: {
// Dynamic colors matching the customization settings
primary: generateShades('primary-color'),
+ dark: 'rgb(var(--dark) / )',
+ light: 'rgb(var(--light) / )',
+ vanta: 'rgb(var(--vanta) / )',
+ metal: 'rgb(var(--metal) / )',
+ yellow: 'rgb(var(--yellow) / )',
+ periwinkle: 'rgb(var(--periwinkle) / )',
+ pomegranate: 'rgb(var(--pomegranate) / )',
+ teal: 'rgb(var(--teal) / )',
'header-background': generateShades('header-background'),
'header-link': generateShades('header-link'),
},
},
+ opacity: opacity(),
},
plugins: [],
};
diff --git a/types/tailwind-shades.d.ts b/types/tailwind-shades.d.ts
index 8a5bb70a2..7e6a9b8c0 100644
--- a/types/tailwind-shades.d.ts
+++ b/types/tailwind-shades.d.ts
@@ -1,16 +1,7 @@
declare module 'tailwind-shades' {
- export type Shade = {
- 50: string;
- 100: string;
- 200: string;
- 300: string;
- 400: string;
- 500: string;
- 600: string;
- 700: string;
- 800: string;
- 900: string;
- };
+ import { shades } from '../tailwind.config';
+
+ export type Shade = Record<(typeof shades)[number], string>;
function shadesOf(color: string): Shade;