#48 : Update custom h elements

This commit is contained in:
Vadim
2021-08-14 15:41:38 +03:00
parent f76fe0b5c6
commit 85cac81f88
11 changed files with 57 additions and 46 deletions

View File

@@ -3,8 +3,7 @@
import Th from './custom/Th.svelte';
import Tr from './custom/Tr.svelte';
import Td from './custom/Td.svelte';
import H1 from './custom/H1.svelte';
import H2 from './custom/H2.svelte';
import { H1, H2 } from './custom/H';
export {
Table as table,
Th as th,

View File

@@ -1,6 +1,6 @@
<script>
import { onMount } from 'svelte'
import { parseTitleStr } from '../../utils/string'
import { parseTitleStr } from '../../../utils/string'
export let titleComponent
let titleEl
@@ -14,6 +14,7 @@
})
</script>
<div>
<svelte:component this={titleComponent} id={anchorId} class="title">
<a class="anchor" href={`#${anchorId}`}>
{title}
@@ -22,9 +23,13 @@
{/if}
</a>
</svelte:component>
</div>
<style>
:global(.title):hover .anchor::before {
:global(.title) {
display: inline-block;
}
:global(.title:hover .anchor::before) {
visibility: visible;
}
.anchor {

View File

@@ -0,0 +1,14 @@
<script>
import H from '../H.svelte'
import H1 from './H1Dom.svelte'
</script>
<H titleComponent={H1}>
<slot />
</H>
<style>
:global(h1.title .anchor::before) {
top: 15px;
}
</style>

View File

@@ -0,0 +1,3 @@
<h1 {...$$props}>
<slot />
</h1>

View File

@@ -0,0 +1,14 @@
<script>
import H from '../H.svelte'
import H2 from './H2Dom.svelte'
</script>
<H titleComponent={H2}>
<slot />
</H>
<style>
:global(h2.title .anchor::before) {
top: 8px;
}
</style>

View File

@@ -0,0 +1,3 @@
<h2 {...$$props}>
<slot />
</h2>

View File

@@ -0,0 +1,7 @@
import H1 from './H1/H1.svelte'
import H2 from './H2/H2.svelte'
export {
H1,
H2
}

View File

@@ -1,8 +0,0 @@
<script>
import H from './H.svelte'
import H1 from './dom/H1.svelte'
</script>
<H titleComponent={H1}>
<slot />
</H>

View File

@@ -1,8 +0,0 @@
<script>
import H from './H.svelte'
import H2 from './dom/H2.svelte'
</script>
<H titleComponent={H2}>
<slot />
</H>

View File

@@ -1,9 +0,0 @@
<h1 {...$$props}>
<slot />
</h1>
<style>
:global(h1 .anchor::before) {
top: 15px;
}
</style>

View File

@@ -1,9 +0,0 @@
<h2 {...$$props}>
<slot />
</h2>
<style>
:global(h2 .anchor::before) {
top: 8px;
}
</style>