Skip to content

Commit a27d4ec

Browse files
authored
Merge pull request #2991 from appwrite/fix/changelog-mobile-responsive
Fix/changelog mobile responsive
2 parents fce98b6 + e142fe9 commit a27d4ec

4 files changed

Lines changed: 50 additions & 7 deletions

File tree

src/lib/utils/code.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export const getCodeHtml = (args: Args) => {
136136
return carry;
137137
}, '');
138138

139-
return `<pre><code class="web-code language-${language} ${
139+
return `<pre class="web-code-pre"><code class="web-code web-code-body language-${language} ${
140140
withLineNumbers ? 'line-numbers' : ''
141141
}">${final}</code></pre>`;
142142
};

src/markdoc/nodes/Fence.svelte

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import { platformMap, preferredPlatform } from '$lib/utils/references';
77
import '$scss/hljs.css';
88
import { melt } from '@melt-ui/svelte';
9+
import { isInChangelog } from '../layouts/Changelog.svelte';
910
import { getContext, hasContext } from 'svelte';
1011
import { get } from 'svelte/store';
1112
import type { CodeContext } from '../tags/MultiCode.svelte';
@@ -29,6 +30,7 @@
2930
}: FenceProps = $props();
3031
3132
const inTutorialDocs = isInTutorialDocs();
33+
const inChangelog = isInChangelog();
3234
const insideMultiCode = hasContext('multi-code');
3335
const selected = insideMultiCode ? getContext<CodeContext>('multi-code').selected : null;
3436
@@ -93,6 +95,7 @@
9395
{:else}
9496
<section
9597
class="dark web-code-snippet not-prose my-8!"
98+
class:in-changelog={inChangelog}
9699
class:no-top-margin={inTutorialDocs}
97100
aria-label="code-snippet panel"
98101
>
@@ -137,4 +140,24 @@
137140
.no-top-margin {
138141
margin-top: unset !important;
139142
}
143+
144+
.in-changelog {
145+
max-width: 100%;
146+
}
147+
148+
.in-changelog .web-code-snippet-content {
149+
max-width: 100%;
150+
overflow-x: auto;
151+
overscroll-behavior-x: contain;
152+
}
153+
154+
.in-changelog :global(.web-code-pre) {
155+
max-width: 100%;
156+
overflow-x: auto;
157+
}
158+
159+
.in-changelog :global(.web-code-body.line-numbers) {
160+
display: block;
161+
min-width: max-content;
162+
}
140163
</style>

src/routes/changelog/ChangelogEntry.svelte

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
export let entry: PageData['entries'][0];
77
</script>
88

9-
<div class="grid gap-5">
9+
<div class="changelog-entry grid min-w-0 gap-5">
1010
<time class="text-eyebrow px-4 uppercase sm:px-0" datetime={entry.date}
1111
>{formatDate(entry.date)}</time
1212
>
@@ -16,7 +16,7 @@
1616
</a>
1717
{/if}
1818

19-
<div class="prose prose-large px-4 sm:px-0">
19+
<div class="entry-content prose prose-large min-w-0 px-4 sm:px-0">
2020
<h2 class="text-title not-prose font-aeonik-pro text-primary mb-8">
2121
<a href={entry.href} onclick={() => trackEvent(`changelog-entry-click`)}>
2222
{entry.title}
@@ -25,3 +25,14 @@
2525
<slot />
2626
</div>
2727
</div>
28+
29+
<style lang="scss">
30+
.changelog-entry,
31+
.entry-content {
32+
min-width: 0;
33+
}
34+
35+
.entry-content {
36+
overflow-x: clip;
37+
}
38+
</style>

src/routes/changelog/[[page]]/+page.svelte

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@
5151
<div class="pt-10">
5252
<div class="web-big-padding-section-level-2">
5353
<div class="wrapper container">
54-
<h1 class="text-display font-aeonik-pro text-primary">Changelog</h1>
55-
<ul>
54+
<h1 class="changelog-heading text-display font-aeonik-pro text-primary">
55+
Changelog
56+
</h1>
57+
<ul class="changelog-list">
5658
{#each data.entries as entry}
5759
<li>
5860
<div class="web-dot"></div>
@@ -88,15 +90,17 @@
8890
--padding-inline: 1rem;
8991
box-sizing: border-box;
9092
max-width: calc(49.375rem + var(--padding-inline) * 2);
93+
min-width: 0;
9194
padding-inline: var(--padding-inline);
9295
}
9396
94-
ul {
97+
.changelog-list {
9598
--padding-is: 2rem;
9699
--dot-offset: 0.25rem;
97100
98101
display: grid;
99102
gap: 5rem;
103+
min-width: 0;
100104
101105
padding-inline-start: var(--padding-is);
102106
border-inline-start: 2px solid transparent;
@@ -120,6 +124,7 @@
120124
}
121125
122126
li {
127+
min-width: 0;
123128
position: relative;
124129
125130
.web-dot {
@@ -131,7 +136,11 @@
131136
}
132137
133138
@media screen and (max-width: 512px) {
134-
ul {
139+
.changelog-heading {
140+
padding-inline: 1rem;
141+
}
142+
143+
.changelog-list {
135144
padding-inline-start: 0;
136145
margin-block-start: 2.5rem;
137146

0 commit comments

Comments
 (0)