made content warnings actually hide the content
This commit is contained in:
parent
919b1f6ebb
commit
0f2a021622
|
@ -3,12 +3,25 @@
|
||||||
|
|
||||||
let rich_text;
|
let rich_text;
|
||||||
post.rich_text().then(res => {rich_text = res});
|
post.rich_text().then(res => {rich_text = res});
|
||||||
|
let open_warned = false;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="post-body">
|
<div class="post-body">
|
||||||
{#if post.warning}
|
{#if post.warning}
|
||||||
<p class="post-warning"><strong>{post.warning}</strong></p>
|
<p class="post-warning" on:click={() => { open_warned = !open_warned }}>
|
||||||
|
<strong>
|
||||||
|
{post.warning}
|
||||||
|
<span class="warning-instructions">
|
||||||
|
{#if !open_warned}
|
||||||
|
(click to reveal)
|
||||||
|
{:else}
|
||||||
|
(click to hide)
|
||||||
{/if}
|
{/if}
|
||||||
|
</span>
|
||||||
|
</strong>
|
||||||
|
</p>
|
||||||
|
{/if}
|
||||||
|
{#if !post.warning || open_warned}
|
||||||
{#if post.text}
|
{#if post.text}
|
||||||
<span class="post-text">{@html rich_text}</span>
|
<span class="post-text">{@html rich_text}</span>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -25,6 +38,7 @@
|
||||||
<p class="post-warning"><strong>this is quoting a post! quotes are not supported yet.</strong></p>
|
<p class="post-warning"><strong>this is quoting a post! quotes are not supported yet.</strong></p>
|
||||||
<!-- TODO: quotes support -->
|
<!-- TODO: quotes support -->
|
||||||
{/if}
|
{/if}
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -34,9 +48,22 @@
|
||||||
|
|
||||||
.post-warning {
|
.post-warning {
|
||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
--warn-bg: rgba(255,220,30,.2);
|
--warn-bg: rgba(255,220,30,.1);
|
||||||
background-image: repeating-linear-gradient(-45deg, transparent, transparent 10px, var(--warn-bg) 10px, var(--warn-bg) 20px);
|
background-image: repeating-linear-gradient(-45deg, transparent, transparent 10px, var(--warn-bg) 10px, var(--warn-bg) 20px);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
outline-color: var(--warn-bg);
|
||||||
|
transition: outline .05s, box-shadow .05s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-warning:hover {
|
||||||
|
outline: 1px solid var(--warn-bg);
|
||||||
|
box-shadow: 0 0 8px var(--warn-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-warning .warning-instructions {
|
||||||
|
font-weight: normal;
|
||||||
|
opacity: .5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-text {
|
.post-text {
|
||||||
|
|
Loading…
Reference in a new issue