Skip to content

Commit 9bdb288

Browse files
committed
Unify outline styles
1 parent c8c57bf commit 9bdb288

File tree

7 files changed

+29
-35
lines changed

7 files changed

+29
-35
lines changed

src/_design-system/mdx-components/mdx-link.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const MdxLink = forwardRef<
1212
{...props}
1313
ref={ref}
1414
className={clsx(
15-
"typography-link text-neu-900 underline-offset-2",
15+
"gql-focus-visible typography-link text-neu-900 underline-offset-2",
1616
props.className,
1717
)}
1818
href={props.href || ""}

src/components/flexsearch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export function Flexsearch({
216216
<HighlightMatches match={search} value={title} />
217217
</div>
218218
{content && (
219-
<div className="excerpt _mt-1 _text-sm _leading-[1.35rem] _text-gray-600 dark:_text-gray-400 contrast-more:dark:_text-gray-50">
219+
<div className="excerpt mt-1 text-sm leading-[1.35rem] text-gray-600 dark:text-gray-400 contrast-more:dark:text-gray-50">
220220
<HighlightMatches match={search} value={content} />
221221
</div>
222222
)}

src/components/pre/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function Pre({
4949
)}
5050
<pre
5151
className={cn(
52-
"overflow-x-auto border border-neu-200 py-4 subpixel-antialiased contrast-more:contrast-150 dark:border-neu-50",
52+
"overflow-x-auto border border-neu-200 py-4 subpixel-antialiased focus-visible:gql-focus-outline contrast-more:contrast-150 dark:border-neu-50",
5353
filename ? "rounded-b-md" : "rounded-md",
5454
className,
5555
)}

src/components/search.tsx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ export function Search({
8585
const icon = mounted && !focused && (
8686
<kbd
8787
className={clsx(
88-
"_my-1.5 _select-none rtl:_left-1.5 absolute right-1.5",
89-
"_h-5 _rounded _bg-white _px-1.5 _font-mono _text-[11px] _font-medium _text-gray-500",
90-
"_border dark:_border-gray-100/20 dark:_bg-black/50",
91-
"contrast-more:_border-current contrast-more:_text-current contrast-more:dark:_border-current",
92-
"_items-center _gap-1 _flex",
93-
"max-sm:_hidden",
88+
"absolute right-1.5 my-1.5 select-none rtl:left-1.5",
89+
"h-5 bg-white px-1.5 font-mono text-[11px] font-medium text-neu-600",
90+
"border dark:border-neu-100/20 dark:bg-neu-0/50",
91+
"contrast-more:border-current contrast-more:text-current contrast-more:dark:border-current",
92+
"flex items-center gap-1",
93+
"max-sm:hidden",
9494
)}
9595
>
9696
{navigator.userAgent.includes("Mac") ? (
@@ -150,11 +150,11 @@ export function Search({
150150
spellCheck={false}
151151
className={({ focus }) =>
152152
clsx(
153-
"rounded-lg px-3 py-2 transition-colors",
153+
"px-3 py-2 transition-colors",
154154
"w-full md:w-64",
155155
"text-base leading-tight md:text-sm",
156156
focus
157-
? "nextra-focusable bg-transparent"
157+
? "bg-transparent focus-visible:gql-focus-outline focus-visible:outline-offset-1"
158158
: "bg-black/[.05] dark:bg-gray-50/10",
159159
"placeholder:text-gray-500 dark:placeholder:text-gray-400",
160160
"contrast-more:border contrast-more:border-current",
@@ -177,10 +177,10 @@ export function Search({
177177
className={({ open }) =>
178178
clsx(
179179
"nextra-scrollbar max-md:h-full",
180-
"border border-gray-200 text-gray-100 dark:border-neutral-800",
181-
"z-20 rounded-xl py-2.5 shadow-xl",
180+
"border border-neu-300 text-neu-700 dark:border-neu-50",
181+
"z-20 py-2.5 shadow-xl",
182182
"contrast-more:border contrast-more:border-gray-900 contrast-more:dark:border-gray-50",
183-
"bg-[rgb(var(--nextra-bg),.8)] backdrop-blur-lg",
183+
"bg-neu-0/70 backdrop-blur-lg",
184184
"transition-opacity motion-reduce:transition-none",
185185
open ? "opacity-100" : "opacity-0",
186186
error || loading || !results.length
@@ -193,13 +193,13 @@ export function Search({
193193
}
194194
>
195195
{error ? (
196-
<span className="_flex _select-none _justify-center _gap-2 _p-8 _text-center _text-sm _text-red-500">
197-
<InformationCircleIcon className="_size-5" />
196+
<span className="flex select-none justify-center gap-2 p-8 text-center text-sm text-red-500">
197+
<InformationCircleIcon className="size-5" />
198198
Failed to load search index.
199199
</span>
200200
) : loading ? (
201-
<span className="_flex _select-none _justify-center _gap-2 _p-8 _text-center _text-sm _text-gray-400">
202-
<SpinnerIcon className="_size-5 _animate-spin" />
201+
<span className="flex select-none justify-center gap-2 p-8 text-center text-sm text-neu-500">
202+
<SpinnerIcon className="size-5 animate-spin" />
203203
Loading…
204204
</span>
205205
) : results.length ? (
@@ -212,12 +212,12 @@ export function Search({
212212
href={searchResult.route}
213213
className={({ focus }) =>
214214
clsx(
215-
"_mx-2.5 _break-words _rounded-md",
216-
"contrast-more:_border",
215+
"mx-2.5 break-words",
216+
"contrast-more:border",
217217
focus
218-
? "_text-primary-600 contrast-more:_border-current _bg-primary-500/10"
219-
: "_text-gray-800 dark:_text-gray-300 contrast-more:_border-transparent",
220-
"_block _scroll-m-12 _px-2.5 _py-2",
218+
? "bg-pri-base/10 text-pri-base contrast-more:border-current dark:text-pri-light"
219+
: "text-neu-800",
220+
"block scroll-m-12 px-2.5 py-2",
221221
)
222222
}
223223
>

src/components/theme-switch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function ThemeSwitch({ lite, className }: ThemeSwitchProps) {
5050
aria-label="Change theme"
5151
title="Change theme"
5252
className={clsx(
53-
"gql-focus-visible relative cursor-pointer text-neu-800 transition-colors before:absolute before:-inset-2 hover:bg-neu-100 hover:text-neu-900 focus-visible:!-outline-offset-2 dark:text-neu-700 dark:hover:bg-neu-50/50",
53+
"gql-focus-visible relative cursor-pointer text-neu-800 transition-colors before:absolute before:-inset-2 hover:bg-neu-100 hover:text-neu-900 focus-visible:outline-offset-4 dark:text-neu-700 dark:hover:bg-neu-50/50",
5454
className,
5555
)}
5656
>

src/globals.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,3 +403,8 @@ html:has([role="menu"][data-open]) {
403403
--mermaid-node-stroke: hsl(var(--color-neu-100));
404404
--mermaid-arrow: hsl(var(--color-neu-300));
405405
}
406+
407+
.nextra-focus.subheading-anchor:focus-visible {
408+
@apply gql-focus-outline after:text-neu-700 focus-visible:outline-offset-1;
409+
box-shadow: none;
410+
}

src/nextra-theme-docs.css

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2958,14 +2958,3 @@ kbd._border._gap-1 {
29582958
color: hsl(var(--color-neu-500));
29592959
}
29602960
}
2961-
2962-
.nextra-search-results {
2963-
& .\_text-primary-600 {
2964-
color: hsl(var(--color-pri-base));
2965-
}
2966-
}
2967-
.dark .nextra-search-results {
2968-
& .\_text-primary-600 {
2969-
color: hsl(var(--color-pri-light));
2970-
}
2971-
}

0 commit comments

Comments
 (0)