Skip to content

Commit 2319b17

Browse files
committed
improvement(docs): remove copy page from mobile view on docs (#2037)
* improvement(docs): remove copy page from mobile view on docs * bring title and pagenav lower on mobile * added cursor pointer to clickable components in docs
1 parent f9640e7 commit 2319b17

File tree

7 files changed

+15
-13
lines changed

7 files changed

+15
-13
lines changed

apps/docs/app/[lang]/[[...slug]]/page.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,17 @@ export default async function Page(props: { params: Promise<{ slug?: string[]; l
198198
component: <CustomFooter />,
199199
}}
200200
>
201-
<div className='relative'>
201+
<div className='relative mt-6 sm:mt-0'>
202202
<div className='absolute top-1 right-0 flex items-center gap-2'>
203-
<CopyPageButton
204-
content={`# ${page.data.title}
203+
<div className='hidden sm:flex'>
204+
<CopyPageButton
205+
content={`# ${page.data.title}
205206
206207
${page.data.description || ''}
207208
208209
${page.data.content || ''}`}
209-
/>
210+
/>
211+
</div>
210212
<PageNavigationArrows previous={neighbours?.previous} next={neighbours?.next} />
211213
</div>
212214
<DocsTitle>{page.data.title}</DocsTitle>

apps/docs/components/docs-layout/sidebar-components.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export function SidebarFolder({
6969
</Link>
7070
<button
7171
onClick={() => setOpen(!open)}
72-
className='rounded p-1 transition-colors hover:bg-gray-100/60 dark:hover:bg-gray-800/40'
72+
className='cursor-pointer rounded p-1 transition-colors hover:bg-gray-100/60 dark:hover:bg-gray-800/40'
7373
aria-label={open ? 'Collapse' : 'Expand'}
7474
>
7575
<ChevronRight
@@ -84,7 +84,7 @@ export function SidebarFolder({
8484
<button
8585
onClick={() => setOpen(!open)}
8686
className={cn(
87-
'flex w-full items-center justify-between rounded-md px-2.5 py-1.5 text-left font-medium text-[13px] leading-tight transition-colors',
87+
'flex w-full cursor-pointer items-center justify-between rounded-md px-2.5 py-1.5 text-left font-medium text-[13px] leading-tight transition-colors',
8888
'hover:bg-gray-100/60 dark:hover:bg-gray-800/40',
8989
'text-gray-800 dark:text-gray-200'
9090
)}

apps/docs/components/ui/code-block.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function CodeBlock(props: React.ComponentProps<typeof FumadocsCodeBlock>)
3030
if (pre) handleCopy(pre.textContent || '')
3131
}}
3232
className={cn(
33-
'rounded-md p-2 transition-all',
33+
'cursor-pointer rounded-md p-2 transition-all',
3434
'border border-border bg-background/80 hover:bg-muted',
3535
'backdrop-blur-sm'
3636
)}

apps/docs/components/ui/copy-page-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function CopyPageButton({ content }: CopyPageButtonProps) {
2323
return (
2424
<button
2525
onClick={handleCopy}
26-
className='flex items-center gap-1.5 rounded-lg border border-border/40 bg-background px-2.5 py-2 text-muted-foreground/60 text-sm leading-none transition-all hover:border-border hover:bg-accent/50 hover:text-muted-foreground'
26+
className='flex cursor-pointer items-center gap-1.5 rounded-lg border border-border/40 bg-background px-2.5 py-2 text-muted-foreground/60 text-sm leading-none transition-all hover:border-border hover:bg-accent/50 hover:text-muted-foreground'
2727
aria-label={copied ? 'Copied to clipboard' : 'Copy page content'}
2828
>
2929
{copied ? (

apps/docs/components/ui/language-dropdown.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export function LanguageDropdown() {
8282
aria-haspopup='listbox'
8383
aria-expanded={isOpen}
8484
aria-controls='language-menu'
85-
className='flex items-center gap-1.5 rounded-xl px-3 py-2 font-normal text-[0.9375rem] text-foreground/60 leading-[1.4] transition-colors hover:bg-foreground/8 hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring'
85+
className='flex cursor-pointer items-center gap-1.5 rounded-xl px-3 py-2 font-normal text-[0.9375rem] text-foreground/60 leading-[1.4] transition-colors hover:bg-foreground/8 hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring'
8686
style={{
8787
fontFamily:
8888
'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
@@ -110,7 +110,7 @@ export function LanguageDropdown() {
110110
}}
111111
role='option'
112112
aria-selected={currentLang === code}
113-
className={`flex w-full items-center gap-3 px-3 py-3 text-base transition-colors first:rounded-t-xl last:rounded-b-xl hover:bg-muted/80 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring md:gap-2 md:px-2.5 md:py-2 md:text-sm ${
113+
className={`flex w-full cursor-pointer items-center gap-3 px-3 py-3 text-base transition-colors first:rounded-t-xl last:rounded-b-xl hover:bg-muted/80 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring md:gap-2 md:px-2.5 md:py-2 md:text-sm ${
114114
currentLang === code ? 'bg-muted/60 font-medium text-primary' : 'text-foreground'
115115
}`}
116116
>

apps/docs/components/ui/search-trigger.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function SearchTrigger() {
1515
return (
1616
<button
1717
type='button'
18-
className='flex h-10 w-[460px] items-center gap-2 rounded-xl border border-border/50 px-3 py-2 text-sm backdrop-blur-xl transition-colors hover:border-border'
18+
className='flex h-10 w-[460px] cursor-pointer items-center gap-2 rounded-xl border border-border/50 px-3 py-2 text-sm backdrop-blur-xl transition-colors hover:border-border'
1919
style={{
2020
backgroundColor: 'hsla(0, 0%, 5%, 0.85)',
2121
backdropFilter: 'blur(33px) saturate(180%)',

apps/docs/components/ui/theme-toggle.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function ThemeToggle() {
1414

1515
if (!mounted) {
1616
return (
17-
<button className='flex items-center justify-center rounded-md p-1 text-muted-foreground'>
17+
<button className='flex cursor-pointer items-center justify-center rounded-md p-1 text-muted-foreground'>
1818
<Moon className='h-4 w-4' />
1919
</button>
2020
)
@@ -23,7 +23,7 @@ export function ThemeToggle() {
2323
return (
2424
<button
2525
onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}
26-
className='flex items-center justify-center rounded-md p-1 text-muted-foreground transition-colors hover:text-foreground'
26+
className='flex cursor-pointer items-center justify-center rounded-md p-1 text-muted-foreground transition-colors hover:text-foreground'
2727
aria-label='Toggle theme'
2828
>
2929
{theme === 'dark' ? <Moon className='h-4 w-4' /> : <Sun className='h-4 w-4' />}

0 commit comments

Comments
 (0)