Skip to content

Commit 1735b45

Browse files
committed
fix: mobile copy button positioning
1 parent 519882e commit 1735b45

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

src/components/Codeblock.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ const Codeblock = ({
251251
/* Context: https://github.com/ethereum/ethereum-org-website/issues/6202 */
252252
<div className={cn("relative", className)} dir="ltr">
253253
<div
254-
className="mb-4 overflow-scroll rounded"
254+
className="overflow-scroll rounded"
255255
style={{
256256
maxHeight: isCollapsed
257257
? `calc((1.2rem * ${LINES_BEFORE_COLLAPSABLE}) + 4.185rem)`

src/pages/index.tsx

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -431,22 +431,24 @@ const HomePage = ({
431431
</p>
432432
</div>
433433
</AccordionTrigger>
434-
<AccordionContent className="max-h-[50vh] overflow-auto border-t">
434+
<AccordionContent className="relative border-t">
435435
<Suspense fallback={<SkeletonLines noOfLines={16} />}>
436-
<Codeblock
437-
codeLanguage={codeLanguage}
438-
allowCollapse={false}
439-
className="[&>div]:-m-2 [&>div]:rounded-none [&_*]:!text-xs [&_pre]:p-4"
440-
fromHomepage
441-
>
442-
{code}
443-
</Codeblock>
444-
<Button
445-
onClick={() => onCopy(code)}
446-
className="absolute end-4 top-24"
447-
>
448-
{hasCopied ? <MdCheck /> : <IoMdCopy />}
449-
</Button>
436+
<div className="-m-2 max-h-[50vh] overflow-auto">
437+
<Codeblock
438+
codeLanguage={codeLanguage}
439+
allowCollapse={false}
440+
className="[&>div]:-m-//2 [&>div]:rounded-none [&_*]:!text-xs [&_pre]:p-4"
441+
fromHomepage
442+
>
443+
{code}
444+
</Codeblock>
445+
<Button
446+
onClick={() => onCopy(code)}
447+
className="absolute end-4 top-4"
448+
>
449+
{hasCopied ? <MdCheck /> : <IoMdCopy />}
450+
</Button>
451+
</div>
450452
</Suspense>
451453
</AccordionContent>
452454
</AccordionItem>

0 commit comments

Comments
 (0)