Skip to content

Commit

Permalink
Tweaks for figure uploading
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonTrollback committed Oct 26, 2023
1 parent e47192d commit 1ab9a13
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
15 changes: 11 additions & 4 deletions src/lib/Figure.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
export let fill = false
export let narrow = false
export let bleed = false
export let label = 'Figure'
/** @type {string?} */
Expand All @@ -25,7 +26,7 @@
const index = ofType.indexOf(item)
</script>

<figure class="figure" class:fill class:narrow id={anchor(id)}>
<figure class="figure" class:fill class:narrow class:bleed id={anchor(id)}>
<div class="main">
<div class:contain={fill}>
<slot />
Expand Down Expand Up @@ -76,14 +77,19 @@
}
.main {
background: #f2f3f8;
padding: var(--page-gutter);
user-select: none;
}
.figure:not(.fill) .main {
border-radius: 0.5rem;
padding: 1.5rem;
padding: 1rem;
border: 1px solid #d7d9dd;
}
.figure.bleed .main {
border: 0;
padding: 0;
}
@media (width > 70rem) {
Expand All @@ -95,7 +101,7 @@
.figure:not(.fill):not(.narrow) .main {
max-width: var(--text-width);
flex: 0 0 auto;
flex: 0 0 100%;
}
.figure:not(.fill):not(.narrow) .caption {
Expand All @@ -107,6 +113,7 @@
.figure :global(img) {
display: block;
width: 100%;
border-radius: 0.5rem;
}
.caption {
Expand Down
12 changes: 12 additions & 0 deletions src/lib/Menu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,18 @@
--menu-color: var(--theme-text-color);
}
.menu:is(:not(.open, :target, .color)) .fade-1 {
opacity: 0.7;
}
.menu:is(:not(.open, :target, .color)) .fade-2 {
opacity: 0.5;
}
.menu:is(:not(.open, :target, .color)) .fade-3 {
opacity: 0.2;
}
@media (width <= 80rem) {
.menu:is(.open, :target) {
position: fixed;
Expand Down
5 changes: 3 additions & 2 deletions src/lib/Modules.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,13 @@
{/if}
</div>
{:else if module._type === 'figure'}
<div class={module.fill ? 'unwrap' : ''} id="module-{module._key}">
<div class:unwrap={module.fill} id="module-{module._key}">
<Figure
fill={module.fill}
bleed={module.bleed}
{narrow}
id={module._key}
label={module.group}>
label={module.label}>
{#if module.image}
<img alt={module.image.alt || ''} src={module.image.asset.url} />
{:else if module.embed?.content}
Expand Down
7 changes: 7 additions & 0 deletions src/routes/(sanity)/studio/[...rest]/types/figure.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ export default defineType({
initialValue: false,
description: 'Grow the figure to cover as much space as possible'
},
{
name: 'bleed',
type: 'boolean',
title: 'No padding',
initialValue: false,
description: 'Hide the gray outline, good for photos and pictures'
},
{
name: 'description',
type: 'array',
Expand Down

0 comments on commit 1ab9a13

Please sign in to comment.