Skip to content

Commit cbd5071

Browse files
Fix mobile styling for example text (#1429)
1 parent ed15bb6 commit cbd5071

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

examples/_components/SnippetComponent.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { ExampleSnippet } from "../types.ts";
21
import Prism from "prismjs";
2+
import { ExampleSnippet } from "../types.ts";
33

44
export default function SnippetComponent(props: {
55
filename: string;
@@ -13,9 +13,11 @@ export default function SnippetComponent(props: {
1313
return (
1414
<div class="grid grid-cols-1 sm:grid-cols-10 gap-x-8">
1515
<div
16-
class={`italic text-right select-none text-sm ${
16+
class={`italic select-none text-sm text-balance ${
1717
props.snippet.text ? "pb-4 mt-4 md:pb-0 " : " "
18-
} ${props.snippet.code ? "col-span-3" : "mt-4 col-span-full"}`}
18+
} ${
19+
props.snippet.code ? "col-span-5 sm:col-span-3" : "mt-4 col-span-full"
20+
}`}
1921
>
2022
{props.snippet.text}
2123
</div>

examples/_pages/ExamplePage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function ExamplePage({ example }: Props) {
1717
}`;
1818

1919
return (
20-
<>
20+
<div data-content="example">
2121
<div class="flex flex-col gap-4 md:flex-row justify-between items-start md:items-center relative">
2222
<div class="flex flex-col gap-2">
2323
{example.parsed.description && (
@@ -37,7 +37,7 @@ export default function ExamplePage({ example }: Props) {
3737
Edit on Github
3838
</a>
3939
</div>
40-
<div class="relative block">
40+
<div class="relative block mt-8">
4141
<CopyButton text={contentNoCommentary} />
4242
</div>
4343
{example.parsed.files.map((file) => (
@@ -122,6 +122,6 @@ export default function ExamplePage({ example }: Props) {
122122
</div>
123123
)}
124124
</div>
125-
</>
125+
</div>
126126
);
127127
}

overrides.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ that are generated by deno_doc, the tool that powers the API reference documenta
3434
@apply -mx-4 !important;
3535
}
3636

37+
[data-content="example"] .markdown-body .highlight {
38+
@apply m-0 !important;
39+
}
40+
3741
.ddoc .markdown-body pre > code:first-child {
3842
@apply px-4 !important;
3943
}

0 commit comments

Comments
 (0)