more edits #116
This commit is contained in:
parent
fa09cbb7ff
commit
e2780e75ae
11 changed files with 69 additions and 46 deletions
|
|
@ -233,10 +233,7 @@
|
||||||
</div>
|
</div>
|
||||||
{#if $$slots.caption}
|
{#if $$slots.caption}
|
||||||
<PaddingReset containerIsFluid="{width === 'fluid'}">
|
<PaddingReset containerIsFluid="{width === 'fluid'}">
|
||||||
<aside
|
<aside class="before-after-caption mx-auto" id="{`${id}-caption`}">
|
||||||
class="before-after-caption mx-auto fmt-2"
|
|
||||||
id="{`${id}-caption`}"
|
|
||||||
>
|
|
||||||
<!-- Caption for image credits -->
|
<!-- Caption for image credits -->
|
||||||
<slot name="caption" />
|
<slot name="caption" />
|
||||||
</aside>
|
</aside>
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
import Block from '../Block/Block.svelte';
|
import Block from '../Block/Block.svelte';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Block width="{width}" id="{id}" class="photo fmy-5 {cls}">
|
<Block width="{width}" id="{id}" class="photo fmy-6 {cls}">
|
||||||
<iframe
|
<iframe
|
||||||
class="h-screen"
|
class="h-screen"
|
||||||
src="https://embed.documentcloud.org/documents/{slug}/?embed=1&responsive=1&title=1"
|
src="https://embed.documentcloud.org/documents/{slug}/?embed=1&responsive=1&title=1"
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@
|
||||||
{:else if notes}
|
{:else if notes}
|
||||||
<PaddingReset containerIsFluid="{width === 'fluid'}">
|
<PaddingReset containerIsFluid="{width === 'fluid'}">
|
||||||
<TextBlock width="{textWidth}">
|
<TextBlock width="{textWidth}">
|
||||||
<aside class="fmt-2">
|
<aside>
|
||||||
{@html marked(notes)}
|
{@html marked(notes)}
|
||||||
</aside>
|
</aside>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="headline-wrapper" style="display:contents;">
|
<div class="headline-wrapper" style="display:contents;">
|
||||||
<Block width="{width}" class="headline text-center fmy-7 fmb-6 {cls}">
|
<Block width="{width}" class="headline text-center fmt-7 fmb-6 {cls}">
|
||||||
<header class="relative">
|
<header class="relative">
|
||||||
{#if $$slots.crown}
|
{#if $$slots.crown}
|
||||||
<div class="crown-container">
|
<div class="crown-container">
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
@include body-caption;
|
@include body-caption;
|
||||||
@include text-primary;
|
@include text-primary;
|
||||||
@include font-medium;
|
@include font-medium;
|
||||||
|
@include tracking-normal;
|
||||||
@include fmt-3;
|
@include fmt-3;
|
||||||
@include fmb-0;
|
@include fmb-0;
|
||||||
text-transform: none;
|
text-transform: none;
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,14 @@
|
||||||
/** Width of the component within the text well. */
|
/** Width of the component within the text well. */
|
||||||
export let width: ContainerWidth = 'wider';
|
export let width: ContainerWidth = 'wider';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a different width for captions within the text well, for example,
|
||||||
|
* "normal" to keep captions inline with the rest of the text well.
|
||||||
|
* Can't ever be wider than `width`.
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
export let textWidth: ContainerWidth = 'normal';
|
||||||
|
|
||||||
/** Add an ID to target with SCSS. */
|
/** Add an ID to target with SCSS. */
|
||||||
export let id: string = '';
|
export let id: string = '';
|
||||||
|
|
||||||
|
|
@ -146,21 +154,23 @@
|
||||||
|
|
||||||
{#if photos[activeImageIndex].caption}
|
{#if photos[activeImageIndex].caption}
|
||||||
<PaddingReset containerIsFluid="{width === 'fluid'}">
|
<PaddingReset containerIsFluid="{width === 'fluid'}">
|
||||||
{#if $$slots.caption}
|
<Block width="{textWidth}">
|
||||||
<slot
|
{#if $$slots.caption}
|
||||||
name="caption"
|
<slot
|
||||||
caption="{photos[activeImageIndex].caption}"
|
name="caption"
|
||||||
/>
|
caption="{photos[activeImageIndex].caption}"
|
||||||
{:else}
|
/>
|
||||||
{#key activeImageIndex}
|
{:else}
|
||||||
<p
|
{#key activeImageIndex}
|
||||||
class="caption body-caption fmt-2"
|
<p
|
||||||
in:fly|local="{{ x: 20, duration: 175 }}"
|
class="caption body-caption text-center"
|
||||||
>
|
in:fly|local="{{ x: 20, duration: 175 }}"
|
||||||
{photos[activeImageIndex].caption}
|
>
|
||||||
</p>
|
{photos[activeImageIndex].caption}
|
||||||
{/key}
|
</p>
|
||||||
{/if}
|
{/key}
|
||||||
|
{/if}
|
||||||
|
</Block>
|
||||||
</PaddingReset>
|
</PaddingReset>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
@ -216,11 +226,17 @@
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
button {
|
button {
|
||||||
|
&.splide__arrow--prev {
|
||||||
|
padding-right: 7px;
|
||||||
|
}
|
||||||
|
&.splide__arrow--next {
|
||||||
|
padding-left: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
width: 30px;
|
width: 30px;
|
||||||
padding: 0;
|
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
control: 'select',
|
control: 'select',
|
||||||
options: ['normal', 'wide', 'wider', 'widest', 'fluid'],
|
options: ['normal', 'wide', 'wider', 'widest', 'fluid'],
|
||||||
},
|
},
|
||||||
captionWidth: {
|
textWidth: {
|
||||||
control: 'select',
|
control: 'select',
|
||||||
options: ['normal', 'wide', 'wider', 'widest', 'fluid'],
|
options: ['normal', 'wide', 'wider', 'widest', 'fluid'],
|
||||||
},
|
},
|
||||||
|
|
@ -65,7 +65,7 @@
|
||||||
ID: 'my-photo-pack',
|
ID: 'my-photo-pack',
|
||||||
Class: 'mb-2',
|
Class: 'mb-2',
|
||||||
Width: 'wide',
|
Width: 'wide',
|
||||||
CaptionWidth: 'normal',
|
textWidth: 'normal',
|
||||||
Gap: '15',
|
Gap: '15',
|
||||||
Images: [
|
Images: [
|
||||||
{
|
{
|
||||||
|
|
@ -129,7 +129,7 @@
|
||||||
name="Default"
|
name="Default"
|
||||||
args="{{
|
args="{{
|
||||||
width: 'wide',
|
width: 'wide',
|
||||||
captionWidth: 'normal',
|
textWidth: 'normal',
|
||||||
images: defaultImages,
|
images: defaultImages,
|
||||||
layouts: defaultLayouts,
|
layouts: defaultLayouts,
|
||||||
}}"
|
}}"
|
||||||
|
|
@ -145,7 +145,7 @@
|
||||||
name="Missing altText"
|
name="Missing altText"
|
||||||
args="{{
|
args="{{
|
||||||
width: 'wide',
|
width: 'wide',
|
||||||
captionWidth: 'normal',
|
textWidth: 'normal',
|
||||||
images: altTextImages,
|
images: altTextImages,
|
||||||
layouts: altTextLayouts,
|
layouts: altTextLayouts,
|
||||||
}}"
|
}}"
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@
|
||||||
* Can't ever be wider than `width`.
|
* Can't ever be wider than `width`.
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
export let captionWidth: ContainerWidth = 'normal';
|
export let textWidth: ContainerWidth = 'normal';
|
||||||
|
|
||||||
import Block from '../Block/Block.svelte';
|
import Block from '../Block/Block.svelte';
|
||||||
import PaddingReset from '../PaddingReset/PaddingReset.svelte';
|
import PaddingReset from '../PaddingReset/PaddingReset.svelte';
|
||||||
|
|
@ -95,7 +95,7 @@
|
||||||
<div
|
<div
|
||||||
class="photopack-row flex justify-between"
|
class="photopack-row flex justify-between"
|
||||||
style:gap="0 {gap}px"
|
style:gap="0 {gap}px"
|
||||||
style:margin-bottom="{gap + 'px'}"
|
style:margin-bottom="{ri < rows.length - 1 ? gap + 'px' : ''}"
|
||||||
>
|
>
|
||||||
{#each row as img, i}
|
{#each row as img, i}
|
||||||
<figure
|
<figure
|
||||||
|
|
@ -118,7 +118,7 @@
|
||||||
</div>
|
</div>
|
||||||
<PaddingReset containerIsFluid="{width === 'fluid'}">
|
<PaddingReset containerIsFluid="{width === 'fluid'}">
|
||||||
<div class="notes contents">
|
<div class="notes contents">
|
||||||
<Block width="{captionWidth}" class="photopack-captions-container">
|
<Block width="{textWidth}" class="photopack-captions-container">
|
||||||
{#each rows as row, ri}
|
{#each rows as row, ri}
|
||||||
{#each row as img, i}
|
{#each row as img, i}
|
||||||
{#if img.caption}
|
{#if img.caption}
|
||||||
|
|
@ -150,10 +150,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.notes {
|
.notes {
|
||||||
:global(.photopack-captions-container) {
|
|
||||||
@include fmy-2;
|
|
||||||
}
|
|
||||||
|
|
||||||
:global(.photopack-captions-container .caption p) {
|
:global(.photopack-captions-container .caption p) {
|
||||||
@include body-caption;
|
@include body-caption;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,28 +17,41 @@ interface Block {
|
||||||
ID?: string;
|
ID?: string;
|
||||||
Class?: string;
|
Class?: string;
|
||||||
Width: string;
|
Width: string;
|
||||||
CaptionWidth?: string;
|
textWidth?: string;
|
||||||
Gap?: string;
|
Gap?: string;
|
||||||
Images: BlockImage[],
|
Images: BlockImage[];
|
||||||
Layouts: BlockLayout[],
|
Layouts: BlockLayout[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getPhotoPackPropsFromDoc = (docBlock: Block, assetsPath: string = '') => {
|
export const getPhotoPackPropsFromDoc = (
|
||||||
|
docBlock: Block,
|
||||||
|
assetsPath: string = ''
|
||||||
|
) => {
|
||||||
return {
|
return {
|
||||||
id: docBlock.ID,
|
id: docBlock.ID,
|
||||||
cls: docBlock.Class,
|
cls: docBlock.Class,
|
||||||
width: docBlock.Width,
|
width: docBlock.Width,
|
||||||
captionWidth: docBlock.CaptionWidth,
|
textWidth: docBlock.textWidth,
|
||||||
gap: docBlock.Gap && isNaN(docBlock.Gap as any) ? null : parseInt(docBlock.Gap),
|
gap:
|
||||||
|
docBlock.Gap && isNaN(docBlock.Gap as any)
|
||||||
|
? null
|
||||||
|
: parseInt(docBlock.Gap),
|
||||||
images: docBlock.Images.map((img) => ({
|
images: docBlock.Images.map((img) => ({
|
||||||
src: /^https?:\/\/|^\/\//i.test(img.Src) ? img.Src : urlJoin(assetsPath, img.Src),
|
src: /^https?:\/\/|^\/\//i.test(img.Src)
|
||||||
|
? img.Src
|
||||||
|
: urlJoin(assetsPath, img.Src),
|
||||||
altText: img.AltText,
|
altText: img.AltText,
|
||||||
caption: img.Caption,
|
caption: img.Caption,
|
||||||
maxHeight: img.MaxHeight && isNaN(img.MaxHeight as any) ? null : parseFloat(img.MaxHeight),
|
maxHeight:
|
||||||
|
img.MaxHeight && isNaN(img.MaxHeight as any)
|
||||||
|
? null
|
||||||
|
: parseFloat(img.MaxHeight),
|
||||||
})),
|
})),
|
||||||
layouts: docBlock.Layouts.map((layout) => ({
|
layouts: docBlock.Layouts.map((layout) => ({
|
||||||
breakpoint: isNaN(layout.Breakpoint as any) ? null : parseFloat(layout.Breakpoint),
|
breakpoint: isNaN(layout.Breakpoint as any)
|
||||||
rows: layout.Rows.split(',').map(r => parseInt(r.trim())),
|
? null
|
||||||
|
: parseFloat(layout.Breakpoint),
|
||||||
|
rows: layout.Rows.split(',').map((r) => parseInt(r.trim())),
|
||||||
})),
|
})),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ Type: photo-pack
|
||||||
ID: my-photo-pack
|
ID: my-photo-pack
|
||||||
Class: mb-2 # adjust margin class as needed
|
Class: mb-2 # adjust margin class as needed
|
||||||
Width: wide
|
Width: wide
|
||||||
CaptionWidth: normal
|
TextWidth: normal
|
||||||
Gap: 10
|
Gap: 10
|
||||||
[.Images]
|
[.Images]
|
||||||
Src: images/my-img-1.jpg
|
Src: images/my-img-1.jpg
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@
|
||||||
description="{description}"
|
description="{description}"
|
||||||
notes="{notes}"
|
notes="{notes}"
|
||||||
width="{width}"
|
width="{width}"
|
||||||
class="video-container fmy-5"
|
class="video-container"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
role="figure"
|
role="figure"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue