diff options
Diffstat (limited to 'src/pages/components')
-rw-r--r-- | src/pages/components/Button.svelte | 29 | ||||
-rw-r--r-- | src/pages/components/Checkbox.svelte | 52 | ||||
-rw-r--r-- | src/pages/components/Input.svelte | 41 | ||||
-rw-r--r-- | src/pages/components/Label.svelte | 18 | ||||
-rw-r--r-- | src/pages/components/Row.svelte | 12 | ||||
-rw-r--r-- | src/pages/components/RowCheckbox.svelte | 14 | ||||
-rw-r--r-- | src/pages/components/RowSelect.svelte | 19 | ||||
-rw-r--r-- | src/pages/components/Select.svelte | 34 |
8 files changed, 219 insertions, 0 deletions
diff --git a/src/pages/components/Button.svelte b/src/pages/components/Button.svelte new file mode 100644 index 00000000..3405c2ea --- /dev/null +++ b/src/pages/components/Button.svelte @@ -0,0 +1,29 @@ +<button on:click {...$$props}> + <slot></slot> +</button> + +<style> + button { + color: var(--text); + border: none; + text-decoration: none; + cursor: pointer; + font-size: 16px; + font-weight: bold; + transition-duration: 0.1s; + display: inline-flex; + align-items: center; + margin: 7.5px 0; + background-color: var(--bg-secondary); + border-radius: 5px; + padding: 10px; + } + + button:hover { + color: var(--active); + } + + button:active { + transform: translateY(1px); + } +</style> diff --git a/src/pages/components/Checkbox.svelte b/src/pages/components/Checkbox.svelte new file mode 100644 index 00000000..dbefd7e9 --- /dev/null +++ b/src/pages/components/Checkbox.svelte @@ -0,0 +1,52 @@ +<script> + export let checked + export let onChange +</script> + +<input {...$$restProps} bind:checked on:change={onChange} type="checkbox" /> + +<style> + input[type="checkbox"] { + appearance: none; + -moz-appearance: none; + -webkit-appearance: none; + width: 46px; + height: 24px; + background-color: var(--light-grey); + border-radius: 50px; + transition: 0.4s; + cursor: pointer; + } + + input[type="checkbox"]:checked { + background-color: var(--active); + } + + input[type="checkbox"]::before { + content: ""; + display: inline-block; + width: 18px; + height: 18px; + box-sizing: border-box; + position: relative; + top: 3px; + left: 3.5px; + background-color: white; + border-radius: 50%; + transition: 0.3s; + } + + input[type="checkbox"]:checked::before { + left: 24px; + } + + /* body.rtl div.block input[type="checkbox"]::before { + left: auto; + right: 4px; + } */ + + /* body.rtl div.block input[type="checkbox"]:checked::before { + left: auto; + right: 24px; + } */ +</style> diff --git a/src/pages/components/Input.svelte b/src/pages/components/Input.svelte new file mode 100644 index 00000000..d963233c --- /dev/null +++ b/src/pages/components/Input.svelte @@ -0,0 +1,41 @@ +<script> + export let value +</script> + +<input + {...$$props} + bind:value + on:blur + on:change + on:click + on:contextmenu + on:focus + on:keydown + on:keypress + on:keyup + on:mouseover + on:mouseenter + on:mouseleave + on:paste + on:input +/> + +<style> + input { + font-weight: bold; + box-sizing: border-box; + color: var(--text); + font-size: 16px; + padding: 8px; + background-color: var(--bg-secondary); + border: none; + margin: 0; + width: 400px; + border-radius: 3px; + outline-color: var(--active); + } + + input:focus { + outline-color: var(--active); + } +</style> diff --git a/src/pages/components/Label.svelte b/src/pages/components/Label.svelte new file mode 100644 index 00000000..39930cd1 --- /dev/null +++ b/src/pages/components/Label.svelte @@ -0,0 +1,18 @@ +<span> + <slot></slot> +</span> + +<style> + span { + font-size: 18px; + } + + span :global(a) { + color: var(--text); + text-decoration: none; + } + + span :global(a:hover) { + text-decoration: underline; + } +</style> diff --git a/src/pages/components/Row.svelte b/src/pages/components/Row.svelte new file mode 100644 index 00000000..68b528e3 --- /dev/null +++ b/src/pages/components/Row.svelte @@ -0,0 +1,12 @@ +<div {...$$props} on:click> + <slot></slot> +</div> + +<style> + div { + justify-content: space-between; + display: flex; + align-items: center; + margin: 20px 0; + } +</style> diff --git a/src/pages/components/RowCheckbox.svelte b/src/pages/components/RowCheckbox.svelte new file mode 100644 index 00000000..b7ccab93 --- /dev/null +++ b/src/pages/components/RowCheckbox.svelte @@ -0,0 +1,14 @@ +<script> + import Row from "./Row.svelte" + import Checkbox from "./Checkbox.svelte" + import Label from "./Label.svelte" + + export let label + export let checked + export let onChange +</script> + +<Row> + <Label>{label}</Label> + <Checkbox bind:checked {onChange} /> +</Row> diff --git a/src/pages/components/RowSelect.svelte b/src/pages/components/RowSelect.svelte new file mode 100644 index 00000000..d685803e --- /dev/null +++ b/src/pages/components/RowSelect.svelte @@ -0,0 +1,19 @@ +<script> + import Row from "./Row.svelte" + import Select from "./Select.svelte" + import Label from "./Label.svelte" + + export let label + export let values + export let value + export let onChange + export let ariaLabel +</script> + +<Row> + <Label>{label}</Label> + <Select {value} {values} {onChange} {ariaLabel} /> +</Row> + +<style> +</style> diff --git a/src/pages/components/Select.svelte b/src/pages/components/Select.svelte new file mode 100644 index 00000000..7829c53e --- /dev/null +++ b/src/pages/components/Select.svelte @@ -0,0 +1,34 @@ +<script> + export let values + export let value + export let onChange + export let ariaLabel +</script> + +<select bind:value on:change={onChange} aria-label={ariaLabel} on:change on:contextmenu on:input> + {#each values as option} + <option value={option.value}>{option.name}</option> + {/each} +</select> + +<style> + select { + font-weight: bold; + box-sizing: border-box; + border-style: solid; + border-color: #767676; + color: var(--text); + font-size: 16px; + padding: 8px; + background-color: var(--bg-secondary); + border: none; + margin: 0; + max-width: 500px; + border-radius: 3px; + } + + select:disabled { + opacity: 0.6; + cursor: not-allowed; + } +</style> |