-
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.
- Loading branch information
1 parent
1cf2748
commit 20361a1
Showing
8 changed files
with
143 additions
and
9 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,10 @@ | ||
<svg width="18" height="18" xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'> | ||
<title>Checkmark</title> | ||
<path | ||
fill='none' | ||
stroke='currentColor' | ||
stroke-linecap='round' | ||
stroke-linejoin='round' | ||
stroke-width='52' | ||
d='M416 128L192 384l-96-96'/> | ||
</svg> |
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,76 @@ | ||
<script> | ||
// Adapted from https://github.com/rob-balfre/svelte-select/blob/master/src/Item.svelte | ||
import CheckMark from './CheckMark.svelte'; | ||
export let isActive = false; | ||
export let isFirst = false; | ||
export let isHover = false; | ||
export let getOptionLabel = undefined; | ||
export let item = undefined; | ||
export let filterText = ''; | ||
let itemClasses = ''; | ||
$: { | ||
const classes = []; | ||
if (isActive) { classes.push('active'); } | ||
if (isFirst) { classes.push('first'); } | ||
if (isHover) { classes.push('hover'); } | ||
if (item.isGroupHeader) { classes.push('groupHeader'); } | ||
if (item.isGroupItem) { classes.push('groupItem'); } | ||
itemClasses = classes.join(' '); | ||
} | ||
</script> | ||
|
||
<div class="item {itemClasses}"> | ||
{@html getOptionLabel(item, filterText)} | ||
{#if isActive} | ||
<CheckMark /> | ||
{/if} | ||
</div> | ||
|
||
<style> | ||
.item { | ||
cursor: default; | ||
height: var(--height, 42px); | ||
line-height: var(--height, 42px); | ||
padding: var(--itemPadding, 0 20px); | ||
color: var(--itemColor, inherit); | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
white-space: nowrap; | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
} | ||
.groupHeader { | ||
text-transform: var(--groupTitleTextTransform, uppercase); | ||
} | ||
.groupItem { | ||
padding-left: var(--groupItemPaddingLeft, 40px); | ||
} | ||
.item:active { | ||
background: var(--itemActiveBackground, #b9daff); | ||
font-weight: bold; | ||
} | ||
.item.active { | ||
background: var(--itemIsActiveBG, #007aff); | ||
color: var(--itemIsActiveColor, #fff); | ||
font-weight: bold; | ||
} | ||
.item.first { | ||
border-radius: var(--itemFirstBorderRadius, 4px 4px 0 0); | ||
} | ||
.item.hover { | ||
background: var(--itemHoverBG, #e7f2ff); | ||
color: var(--itemHoverColor, #000); | ||
} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<script> | ||
import Select from 'svelte-select'; | ||
import SelectItem from './components/SelectItem.svelte'; | ||
import { journals } from './inputs/constants'; | ||
import { selectedJournal } from './stores/selections'; | ||
function handleSelect(event) { | ||
selectedJournal.set(event.detail.value); | ||
} | ||
</script> | ||
|
||
<div class="select"> | ||
<Select | ||
items={journals} | ||
Item={SelectItem} | ||
selectedValue={journals[0]} | ||
isClearable={false} | ||
showIndicator | ||
on:select={handleSelect} /> | ||
</div> | ||
|
||
<style> | ||
.select { | ||
color: white; | ||
--borderFocusColor: white; | ||
--background: var(--background-color); | ||
--listBackground: var(--background-color); | ||
--itemColor: white; | ||
--itemIsActiveColor: white; | ||
--inputColor: white; | ||
--itemActiveBackground: var(--background-color); | ||
--itemIsActiveBG: var(--background-color); | ||
--itemHoverBG: white; | ||
--itemHoverColor: var(--background-color); | ||
--borderRadius: 5px; | ||
--listBorderRadius: 5px; | ||
} | ||
</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