Skip to content

Commit

Permalink
feat: css for print #18 (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
joselegitan authored and frodrigo committed Dec 4, 2023
1 parent 7b241ac commit 20a75da
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 6 deletions.
2 changes: 1 addition & 1 deletion components/Layout/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:logo-url="theme && theme.logo_url"
/>

<div class="tw-flex tw-justify-end">
<div class="tw-flex tw-justify-end print:tw-hidden">
<slot></slot>
<NavMenu :entries="navMenuEntries" />
</div>
Expand Down
2 changes: 1 addition & 1 deletion components/Layout/PoiLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div v-if="icon" class="tw-flex tw-justify-center">
<TeritorioIconBadge :color-fill="colorFill" size="2xl" :picto="icon" />
</div>
<h1>{{ name }}</h1>
<h1 class="print:tw-pb-4">{{ name }}</h1>
<slot name="actions"></slot>
<slot name="body"></slot>
<Footer :attributions="settings.attributions">
Expand Down
2 changes: 1 addition & 1 deletion components/PoisCard/PoisDeck.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
:key="item.properties.metadata.id"
:poi="item"
:class="[
'tw-grow-1',
'tw-grow-1 poi-deck',
!isFavorite(item.properties.metadata.id) &&
'tw-bg-zinc-200 tw-opacity-70',
]"
Expand Down
2 changes: 1 addition & 1 deletion components/PoisDetails/Carousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<v-carousel
:show-arrows="false"
:hide-delimiter-background="true"
class="mb-14"
class="tw-mb-14 print:tw-mb-6"
:height="smallScreen ? 300 : 500"
>
<v-carousel-item v-for="(image, i) in images" :key="i">
Expand Down
8 changes: 7 additions & 1 deletion components/PoisDetails/FieldsGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
field.group !== undefined &&
!isListEmpty(field.fields, properties, geom)
"
class="block"
class="block print:tw-mb-2"
>
<div v-if="field.display_mode === 'standard'">
<FieldsHeader
Expand All @@ -28,6 +28,7 @@
v-else-if="field.display_mode === 'card'"
:color-fill="colorFill"
:icon="field.icon"
class="print:tw-hidden"
>
<FieldsHeader
v-if="fieldTranslateK(field.group)"
Expand Down Expand Up @@ -153,4 +154,9 @@ export default defineNuxtComponent({
.block {
margin-bottom: 3rem;
}
@media print {
.block {
margin-bottom: 0.5rem !important;
}
}
</style>
3 changes: 2 additions & 1 deletion components/PoisDetails/PoiDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
</template>
<template #actions>
<Share
class="print:tw-hidden"
:title="poi.properties.name"
:href="
poi.properties.editorial &&
Expand Down Expand Up @@ -68,7 +69,7 @@
:extra-attributions="settings.attributions"
:feature-ids="[id]"
:features="[poi]"
class="tw-relative"
class="tw-relative poi-map"
:off-map-attribution="true"
/>
</template>
Expand Down
17 changes: 17 additions & 0 deletions pages/poi/[id]/details.vue
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,20 @@ export default defineNuxtComponent({
@extend .font-light;
}
</style>

<style>
body,
#__nuxt,
#__layout {
-webkit-print-color-adjust: exact;
}
img,
.poi-deck,
.poi-map,
#route-map {
page-break-before: auto;
page-break-after: auto;
page-break-inside: avoid;
}
</style>
3 changes: 3 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ module.exports = {
flexBasis: {
max: 'max-content',
},
screens: {
print: { raw: 'print' },
},
},
},
plugins: [require('@tailwindcss/forms'), require('@tailwindcss/typography')],
Expand Down

0 comments on commit 20a75da

Please sign in to comment.