Skip to content

Commit

Permalink
Fix sticky figure desc
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonTrollback committed Oct 30, 2023
1 parent 0f912ed commit 46eddad
Showing 1 changed file with 25 additions and 27 deletions.
52 changes: 25 additions & 27 deletions src/lib/Figure.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,31 @@
</div>
</div>
{#if $$slots.description || $$slots.source}
<figcaption class:contain={fill}>
<div class="caption">
<Html size="small">
<div
class="description"
data-prefix={index != null
? `${label} ${shortcode ? `${shortcode}.` : ''}${index + 1} `
: ''}>
<slot name="description" />
</div>
{#if $$slots.source}
<details class="source">
<summary class="summary">
<span>Source</span>
<svg class="chevron" viewBox="0 -960 960 960">
<path
fill="currentcolor"
d="M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z" />
</svg>
</summary>
<div class="body">
<slot name="source" />
</div>
</details>
{/if}
</Html>
</div>
<figcaption class:contain={fill} class="caption">
<Html size="small">
<div
class="description"
data-prefix={index != null
? `${label} ${shortcode ? `${shortcode}.` : ''}${index + 1} `
: ''}>
<slot name="description" />
</div>
{#if $$slots.source}
<details class="source">
<summary class="summary">
<span>Source</span>
<svg class="chevron" viewBox="0 -960 960 960">
<path
fill="currentcolor"
d="M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z" />
</svg>
</summary>
<div class="body">
<slot name="source" />
</div>
</details>
{/if}
</Html>
</figcaption>
{/if}
</figure>
Expand Down

0 comments on commit 46eddad

Please sign in to comment.