-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from hyvor/divider
fixes #4
- Loading branch information
Showing
5 changed files
with
196 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<script lang="ts"> | ||
export let color : string = 'var(--accent-lightest)'; | ||
export let height : number = 1; | ||
export let width : number = 100; | ||
export let margin : number = 0; | ||
export let align: 'start' | 'center' | 'end' = 'center'; | ||
</script> | ||
<!-- <div | ||
class="line" | ||
style=" | ||
background-color: {color}; | ||
height: {height}px; | ||
width: {width}%; | ||
margin: {margin}px 0; | ||
align: {align}; | ||
" | ||
/> | ||
<style> | ||
</style> --> | ||
|
||
<!-- <div | ||
class="line" | ||
style=" | ||
background-color: {color}; | ||
height: {height}px; | ||
width: {width}%; | ||
margin-top: {margin}px; | ||
margin-bottom: {margin}px; | ||
margin-left: {align === 'end' ? 'auto' : '0'}; | ||
margin-right: {align === 'start' ? 'auto' : '0'}; | ||
" | ||
/> --> | ||
|
||
<div | ||
class="line" | ||
style=" | ||
background-color: {color}; | ||
height: {height}px; | ||
width: {width}%; | ||
margin-top: {margin}px; | ||
margin-bottom: {margin}px; | ||
margin-left: {align === 'center' || align === 'end' ? 'auto' : 0}; | ||
margin-right: {align === 'center' ? 'auto' : 0}; | ||
display: flex; | ||
" | ||
/> | ||
|
||
<style> | ||
.line { | ||
display: block; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
<script lang="ts"> | ||
import Divider from "$lib/components/Divider/Divider.svelte"; | ||
import CodeBlock from "$lib/components/CodeBlock/CodeBlock.svelte"; | ||
import CodeResult from "./Helper/CodeResult.svelte"; | ||
import Table from "$lib/components/Table/Table.svelte"; | ||
import TableRow from "$lib/components/Table/TableRow.svelte"; | ||
</script> | ||
|
||
<h1>Divider</h1> | ||
|
||
<p>This is a horizontal line used to divide sections.</p> | ||
|
||
<h2 id="props">Properties</h2> | ||
|
||
<Table columns="2fr 2fr 3fr"> | ||
<TableRow head> | ||
<div>Name</div> | ||
<div>Default</div> | ||
<div>Description</div> | ||
</TableRow> | ||
|
||
<TableRow> | ||
<div><code>color</code></div> | ||
<div><code>var(--accent-lightest)</code></div> | ||
<div>The color of the divider.</div> | ||
</TableRow> | ||
|
||
<TableRow> | ||
<div><code>height</code></div> | ||
<div><code>1</code></div> | ||
<div>The height of the divider in pixels (px).</div> | ||
</TableRow> | ||
|
||
<TableRow> | ||
<div><code>width</code></div> | ||
<div><code>100</code></div> | ||
<div>The width of the divider as a percentage (%).</div> | ||
</TableRow> | ||
|
||
<TableRow> | ||
<div><code>margin</code></div> | ||
<div><code>0</code></div> | ||
<div>The margin of the divider in pixels (px).</div> | ||
</TableRow> | ||
|
||
<TableRow> | ||
<div><code>align</code></div> | ||
<div><code>center</code></div> | ||
<div> | ||
The alignment of the divider | ||
<ul> | ||
<li><code>start</code></li> | ||
<li><code>center</code></li> | ||
<li><code>end</code></li> | ||
</ul> | ||
</div> | ||
</TableRow> | ||
|
||
</Table> | ||
|
||
<h2>Examples</h2> | ||
|
||
<p>Here, we have a simple divider with the default settings.</p> | ||
|
||
<CodeBlock code={` | ||
<Divider /> | ||
`} /> | ||
|
||
<CodeResult style="background-color:var(-accent-light)"> | ||
<Divider /> | ||
</CodeResult> | ||
|
||
<p> | ||
with <code>align="center"</code> | ||
</p> | ||
|
||
<CodeBlock code={` | ||
<Divider | ||
color=var(--red-light) | ||
height={3} | ||
width={50} | ||
margin={3} | ||
align="center" | ||
/> | ||
`} /> | ||
|
||
<CodeResult style="background-color:var(-accent-light)"> | ||
<Divider color=var(--red-light) height={3} width={50} margin={3} align='center'/> | ||
</CodeResult> | ||
|
||
<p> | ||
with <code>align="start"</code> | ||
</p> | ||
|
||
<CodeBlock code={` | ||
<Divider | ||
color=var(--blue-light) | ||
height={2} | ||
width={80} | ||
margin={5} | ||
align="start" | ||
/> | ||
`} /> | ||
|
||
<CodeResult style="background-color:var(-accent-light)"> | ||
<Divider color="var(--blue-light)" height={2} width={80} margin={5} align='start'/> | ||
</CodeResult> | ||
|
||
|
||
<CodeBlock code={` | ||
<Divider | ||
color="var(--green-light)" | ||
height={4} | ||
width={70} | ||
margin={7} | ||
align="end" | ||
/> | ||
`} /> | ||
|
||
<CodeResult style="background-color:var(-accent-light)"> | ||
<Divider | ||
color="var(--green-light)" | ||
height={4} | ||
width={70} | ||
margin={7} | ||
align="end" | ||
/> | ||
</CodeResult> | ||
|
||
<style> | ||
</style> | ||
|