#48 : Update custom h elements
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,17 +14,22 @@
|
||||
})
|
||||
</script>
|
||||
|
||||
<svelte:component this={titleComponent} id={anchorId} class="title">
|
||||
<div>
|
||||
<svelte:component this={titleComponent} id={anchorId} class="title">
|
||||
<a class="anchor" href={`#${anchorId}`}>
|
||||
{title}
|
||||
{#if !title}
|
||||
<span bind:this={titleEl}><slot /></span>
|
||||
{/if}
|
||||
</a>
|
||||
</svelte:component>
|
||||
</svelte:component>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
:global(.title):hover .anchor::before {
|
||||
:global(.title) {
|
||||
display: inline-block;
|
||||
}
|
||||
:global(.title:hover .anchor::before) {
|
||||
visibility: visible;
|
||||
}
|
||||
.anchor {
|
||||
14
src/docs/Layouts/custom/H/H1/H1.svelte
Normal file
14
src/docs/Layouts/custom/H/H1/H1.svelte
Normal 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>
|
||||
3
src/docs/Layouts/custom/H/H1/H1Dom.svelte
Normal file
3
src/docs/Layouts/custom/H/H1/H1Dom.svelte
Normal file
@@ -0,0 +1,3 @@
|
||||
<h1 {...$$props}>
|
||||
<slot />
|
||||
</h1>
|
||||
14
src/docs/Layouts/custom/H/H2/H2.svelte
Normal file
14
src/docs/Layouts/custom/H/H2/H2.svelte
Normal 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>
|
||||
3
src/docs/Layouts/custom/H/H2/H2Dom.svelte
Normal file
3
src/docs/Layouts/custom/H/H2/H2Dom.svelte
Normal file
@@ -0,0 +1,3 @@
|
||||
<h2 {...$$props}>
|
||||
<slot />
|
||||
</h2>
|
||||
7
src/docs/Layouts/custom/H/index.js
Normal file
7
src/docs/Layouts/custom/H/index.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import H1 from './H1/H1.svelte'
|
||||
import H2 from './H2/H2.svelte'
|
||||
|
||||
export {
|
||||
H1,
|
||||
H2
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<script>
|
||||
import H from './H.svelte'
|
||||
import H1 from './dom/H1.svelte'
|
||||
</script>
|
||||
|
||||
<H titleComponent={H1}>
|
||||
<slot />
|
||||
</H>
|
||||
@@ -1,8 +0,0 @@
|
||||
<script>
|
||||
import H from './H.svelte'
|
||||
import H2 from './dom/H2.svelte'
|
||||
</script>
|
||||
|
||||
<H titleComponent={H2}>
|
||||
<slot />
|
||||
</H>
|
||||
@@ -1,9 +0,0 @@
|
||||
<h1 {...$$props}>
|
||||
<slot />
|
||||
</h1>
|
||||
|
||||
<style>
|
||||
:global(h1 .anchor::before) {
|
||||
top: 15px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,9 +0,0 @@
|
||||
<h2 {...$$props}>
|
||||
<slot />
|
||||
</h2>
|
||||
|
||||
<style>
|
||||
:global(h2 .anchor::before) {
|
||||
top: 8px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user