Skip to content

Commit 872c5b6

Browse files
authored
chore: fix responsiveness on narrow viewports (#236)
1 parent 4587306 commit 872c5b6

1 file changed

Lines changed: 40 additions & 8 deletions

File tree

app/pages/[...package].vue

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ defineOgImageComponent('Package', {
300300

301301
<article
302302
v-else-if="status === 'success' && pkg"
303-
class="package-page motion-safe:animate-fade-in"
303+
class="package-page motion-safe:animate-fade-in overflow-x-hidden"
304304
>
305305
<!-- Package header -->
306306
<header class="area-header pb-8 border-b border-border">
@@ -716,11 +716,11 @@ defineOgImageComponent('Package', {
716716
<span class="w-2.5 h-2.5 rounded-full bg-fg-subtle" />
717717
<span class="w-2.5 h-2.5 rounded-full bg-fg-subtle" />
718718
</div>
719-
<div class="space-y-1 px-3 pt-2 pb-3 sm:px-4 sm:pt-3 sm:pb-4">
719+
<div class="space-y-1 px-3 pt-2 pb-3 sm:px-4 sm:pt-3 sm:pb-4 overflow-x-auto">
720720
<!-- Main package install -->
721-
<div class="flex items-center gap-2">
722-
<span class="text-fg-subtle font-mono text-sm select-none">$</span>
723-
<code class="font-mono text-sm"
721+
<div class="flex items-center gap-2 min-w-0">
722+
<span class="text-fg-subtle font-mono text-sm select-none shrink-0">$</span>
723+
<code class="font-mono text-sm min-w-0"
724724
><ClientOnly
725725
><span
726726
v-for="(part, i) in installCommandParts"
@@ -735,9 +735,9 @@ defineOgImageComponent('Package', {
735735
>
736736
</div>
737737
<!-- @types package install (when enabled) -->
738-
<div v-if="showTypesInInstall" class="flex items-center gap-2">
739-
<span class="text-fg-subtle font-mono text-sm select-none">$</span>
740-
<code class="font-mono text-sm"
738+
<div v-if="showTypesInInstall" class="flex items-center gap-2 min-w-0">
739+
<span class="text-fg-subtle font-mono text-sm select-none shrink-0">$</span>
740+
<code class="font-mono text-sm min-w-0"
741741
><span
742742
v-for="(part, i) in typesInstallCommandParts"
743743
:key="i"
@@ -953,4 +953,36 @@ defineOgImageComponent('Package', {
953953
.area-sidebar {
954954
grid-area: sidebar;
955955
}
956+
957+
/* Improve package name wrapping for narrow screens */
958+
.area-header h1 {
959+
overflow-wrap: anywhere;
960+
}
961+
962+
/* Ensure description text wraps properly */
963+
.area-header p {
964+
word-wrap: break-word;
965+
overflow-wrap: break-word;
966+
word-break: break-word;
967+
}
968+
969+
/* Allow install command text to break on narrow screens */
970+
.area-install code {
971+
word-break: break-word;
972+
overflow-wrap: anywhere;
973+
white-space: pre-wrap;
974+
}
975+
976+
/* Ensure all text content wraps on narrow screens */
977+
.package-page {
978+
word-wrap: break-word;
979+
overflow-wrap: break-word;
980+
max-width: 100%;
981+
}
982+
983+
/* Ensure all children respect max-width */
984+
.package-page > * {
985+
max-width: 100%;
986+
min-width: 0;
987+
}
956988
</style>

0 commit comments

Comments
 (0)