UX: add indication for enter to open

This commit is contained in:
Robin van der Linde 2023-07-05 23:39:40 +02:00
parent 3df5727f40
commit f89b8a5323
Signed by untrusted user who does not match committer: Robin-van-der-Linde
GPG key ID: 53956B3252478F0D
3 changed files with 385 additions and 45 deletions

View file

@ -12,6 +12,7 @@
export let isCustom: boolean = false
export let userDetails: UIEventSource<UserDetails>
export let state: { layoutToUse?: { id: string }; osmConnection: OsmConnection }
export let selected: boolean = false
$: title = new Translation(
theme.title,
@ -78,6 +79,11 @@
<span class="subtle max-h-12 truncate text-ellipsis">
<Tr t={description} />
</span>
{#if selected}
<span class="alert">
Press enter to open theme
</span>
{/if}
</span>
</SubtleLink>
{/if}

View file

@ -6,6 +6,7 @@
import ThemeButton from "./ThemeButton.svelte"
import { LayoutInformation } from "../../Models/ThemeConfig/LayoutConfig"
import MoreScreen from "./MoreScreen"
import themeOverview from "../../assets/generated/theme_overview.json"
export let search: UIEventSource<string>
export let themes: LayoutInformation[]
@ -16,6 +17,10 @@
// Filter theme based on search value
$: filteredThemes = themes.filter((theme) => MoreScreen.MatchesLayout(theme, $search))
// Determine which is the first theme, after the search, using all themes
$: allFilteredThemes = themeOverview.filter((theme) => MoreScreen.MatchesLayout(theme, $search))
$: firstTheme = allFilteredThemes[0]
</script>
<section class="w-full">
@ -24,7 +29,18 @@
<div class="gap-4 md:grid md:grid-flow-row md:grid-cols-2 lg:grid-cols-3">
{#each filteredThemes as theme (theme.id)}
{#if theme !== undefined && !(hideThemes && theme?.hideFromOverview)}
<ThemeButton {theme} {isCustom} userDetails={state.osmConnection.userDetails} {state} />
<!-- TODO: doesn't work if first theme is hidden -->
{#if theme === firstTheme && !isCustom && $search !== "" && $search !== undefined}
<ThemeButton
{theme}
{isCustom}
userDetails={state.osmConnection.userDetails}
{state}
selected={true}
/>
{:else}
<ThemeButton {theme} {isCustom} userDetails={state.osmConnection.userDetails} {state} />
{/if}
{/if}
{/each}
</div>

View file

@ -638,6 +638,17 @@ video {
border-width: 0;
}
.not-sr-only {
position: static;
width: auto;
height: auto;
padding: 0;
margin: 0;
overflow: visible;
clip: auto;
white-space: normal;
}
.pointer-events-none {
pointer-events: none;
}
@ -687,6 +698,20 @@ video {
position: sticky;
}
.inset-0 {
top: 0px;
right: 0px;
bottom: 0px;
left: 0px;
}
.-inset-1 {
top: -0.25rem;
right: -0.25rem;
bottom: -0.25rem;
left: -0.25rem;
}
.left-24 {
left: 6rem;
}
@ -719,6 +744,26 @@ video {
bottom: 0px;
}
.top-12 {
top: 3rem;
}
.left-3 {
left: 0.75rem;
}
.top-3 {
top: 0.75rem;
}
.right-2 {
right: 0.5rem;
}
.bottom-3 {
bottom: 0.75rem;
}
.right-1\/3 {
right: 33.333333%;
}
@ -735,10 +780,6 @@ video {
top: 2.5rem;
}
.top-4 {
top: 1rem;
}
.left-1\/2 {
left: 50%;
}
@ -751,6 +792,10 @@ video {
isolation: isolate;
}
.isolation-auto {
isolation: auto;
}
.float-right {
float: right;
}
@ -875,14 +920,6 @@ video {
margin-bottom: 1rem;
}
.ml-4 {
margin-left: 1rem;
}
.mb-24 {
margin-bottom: 6rem;
}
.ml-1 {
margin-left: 0.25rem;
}
@ -911,6 +948,10 @@ video {
margin-bottom: 0.25rem;
}
.ml-4 {
margin-left: 1rem;
}
.mt-3 {
margin-top: 0.75rem;
}
@ -979,14 +1020,62 @@ video {
display: table;
}
.inline-table {
display: inline-table;
}
.table-caption {
display: table-caption;
}
.table-cell {
display: table-cell;
}
.table-column {
display: table-column;
}
.table-column-group {
display: table-column-group;
}
.table-footer-group {
display: table-footer-group;
}
.table-header-group {
display: table-header-group;
}
.table-row-group {
display: table-row-group;
}
.table-row {
display: table-row;
}
.flow-root {
display: flow-root;
}
.grid {
display: grid;
}
.inline-grid {
display: inline-grid;
}
.contents {
display: contents;
}
.list-item {
display: list-item;
}
.hidden {
display: none;
}
@ -1033,6 +1122,11 @@ video {
height: 1rem;
}
.h-min {
height: -webkit-min-content;
height: min-content;
}
.h-1\/2 {
height: 50%;
}
@ -1193,6 +1287,10 @@ video {
flex-shrink: 0;
}
.shrink {
flex-shrink: 1;
}
.grow {
flex-grow: 1;
}
@ -1259,6 +1357,11 @@ video {
resize: both;
}
.appearance-none {
-webkit-appearance: none;
appearance: none;
}
.grid-cols-1 {
grid-template-columns: repeat(1, minmax(0, 1fr));
}
@ -1355,6 +1458,34 @@ video {
column-gap: 0.25rem;
}
.space-y-reverse > :not([hidden]) ~ :not([hidden]) {
--tw-space-y-reverse: 1;
}
.space-x-reverse > :not([hidden]) ~ :not([hidden]) {
--tw-space-x-reverse: 1;
}
.divide-x > :not([hidden]) ~ :not([hidden]) {
--tw-divide-x-reverse: 0;
border-right-width: calc(1px * var(--tw-divide-x-reverse));
border-left-width: calc(1px * calc(1 - var(--tw-divide-x-reverse)));
}
.divide-y > :not([hidden]) ~ :not([hidden]) {
--tw-divide-y-reverse: 0;
border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));
border-bottom-width: calc(1px * var(--tw-divide-y-reverse));
}
.divide-y-reverse > :not([hidden]) ~ :not([hidden]) {
--tw-divide-y-reverse: 1;
}
.divide-x-reverse > :not([hidden]) ~ :not([hidden]) {
--tw-divide-x-reverse: 1;
}
.self-start {
align-self: flex-start;
}
@ -1375,6 +1506,10 @@ video {
overflow: hidden;
}
.overflow-scroll {
overflow: scroll;
}
.overflow-y-auto {
overflow-y: auto;
}
@ -1393,6 +1528,10 @@ video {
text-overflow: ellipsis;
}
.text-clip {
text-overflow: clip;
}
.break-normal {
overflow-wrap: normal;
word-break: normal;
@ -1418,14 +1557,18 @@ video {
border-radius: 1rem;
}
.rounded-md {
border-radius: 0.375rem;
.rounded-3xl {
border-radius: 1.5rem;
}
.rounded-lg {
border-radius: 0.5rem;
}
.rounded-md {
border-radius: 0.375rem;
}
.rounded-sm {
border-radius: 0.125rem;
}
@ -1435,6 +1578,37 @@ video {
border-bottom-left-radius: 0.25rem;
}
.rounded-t {
border-top-left-radius: 0.25rem;
border-top-right-radius: 0.25rem;
}
.rounded-r {
border-top-right-radius: 0.25rem;
border-bottom-right-radius: 0.25rem;
}
.rounded-b {
border-bottom-right-radius: 0.25rem;
border-bottom-left-radius: 0.25rem;
}
.rounded-tl {
border-top-left-radius: 0.25rem;
}
.rounded-tr {
border-top-right-radius: 0.25rem;
}
.rounded-br {
border-bottom-right-radius: 0.25rem;
}
.rounded-bl {
border-bottom-left-radius: 0.25rem;
}
.border {
border-width: 1px;
}
@ -1447,6 +1621,16 @@ video {
border-width: 2px;
}
.border-x {
border-left-width: 1px;
border-right-width: 1px;
}
.border-y {
border-top-width: 1px;
border-bottom-width: 1px;
}
.border-b {
border-bottom-width: 1px;
}
@ -1455,12 +1639,20 @@ video {
border-bottom-width: 2px;
}
.border-dashed {
border-style: dashed;
.border-t {
border-top-width: 1px;
}
.border-dotted {
border-style: dotted;
.border-r {
border-right-width: 1px;
}
.border-l {
border-left-width: 1px;
}
.border-dashed {
border-style: dashed;
}
.border-black {
@ -1478,16 +1670,16 @@ video {
border-color: rgb(209 213 219 / var(--tw-border-opacity));
}
.border-gray-400 {
--tw-border-opacity: 1;
border-color: rgb(156 163 175 / var(--tw-border-opacity));
}
.border-gray-600 {
--tw-border-opacity: 1;
border-color: rgb(75 85 99 / var(--tw-border-opacity));
}
.border-gray-400 {
--tw-border-opacity: 1;
border-color: rgb(156 163 175 / var(--tw-border-opacity));
}
.border-gray-500 {
--tw-border-opacity: 1;
border-color: rgb(107 114 128 / var(--tw-border-opacity));
@ -1507,6 +1699,11 @@ video {
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
}
.bg-red-500 {
--tw-bg-opacity: 1;
background-color: rgb(239 68 68 / var(--tw-bg-opacity));
}
.bg-black {
--tw-bg-opacity: 1;
background-color: rgb(0 0 0 / var(--tw-bg-opacity));
@ -1527,6 +1724,10 @@ video {
background-color: rgb(220 38 38 / var(--tw-bg-opacity));
}
.bg-repeat {
background-repeat: repeat;
}
.p-8 {
padding: 2rem;
}
@ -1539,6 +1740,10 @@ video {
padding: 0.5rem;
}
.p-3 {
padding: 0.75rem;
}
.p-4 {
padding: 1rem;
}
@ -1583,6 +1788,10 @@ video {
padding-right: 0.5rem;
}
.pl-3 {
padding-left: 0.75rem;
}
.pl-2 {
padding-left: 0.5rem;
}
@ -1599,10 +1808,6 @@ video {
padding-top: 0px;
}
.pt-2 {
padding-top: 0.5rem;
}
.pl-5 {
padding-left: 1.25rem;
}
@ -1615,10 +1820,6 @@ video {
padding-left: 1rem;
}
.pl-3 {
padding-left: 0.75rem;
}
.pr-0 {
padding-right: 0px;
}
@ -1678,6 +1879,11 @@ video {
line-height: 1.5rem;
}
.text-xs {
font-size: 0.75rem;
line-height: 1rem;
}
.font-bold {
font-weight: 700;
}
@ -1702,15 +1908,61 @@ video {
text-transform: lowercase;
}
.capitalize {
text-transform: capitalize;
}
.normal-case {
text-transform: none;
}
.italic {
font-style: italic;
}
.not-italic {
font-style: normal;
}
.normal-nums {
font-variant-numeric: normal;
}
.ordinal {
--tw-ordinal: ordinal;
font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction);
}
.slashed-zero {
--tw-slashed-zero: slashed-zero;
font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction);
}
.lining-nums {
--tw-numeric-figure: lining-nums;
font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction);
}
.oldstyle-nums {
--tw-numeric-figure: oldstyle-nums;
font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction);
}
.proportional-nums {
--tw-numeric-spacing: proportional-nums;
font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction);
}
.tabular-nums {
--tw-numeric-spacing: tabular-nums;
font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction);
}
.diagonal-fractions {
--tw-numeric-fraction: diagonal-fractions;
font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction);
}
.leading-none {
line-height: 1;
}
@ -1751,11 +2003,20 @@ video {
text-decoration-line: line-through;
}
.no-underline {
text-decoration-line: none;
}
.antialiased {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.subpixel-antialiased {
-webkit-font-smoothing: auto;
-moz-osx-font-smoothing: auto;
}
.opacity-50 {
opacity: 0.5;
}
@ -1776,6 +2037,10 @@ video {
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
}
.ring-inset {
--tw-ring-inset: inset;
}
.blur {
--tw-blur: blur(8px);
-webkit-filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
@ -1794,6 +2059,12 @@ video {
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
}
.drop-shadow {
--tw-drop-shadow: drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow(0 1px 1px rgb(0 0 0 / 0.06));
-webkit-filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
}
.grayscale {
--tw-grayscale: grayscale(100%);
-webkit-filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
@ -1822,6 +2093,35 @@ video {
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow) !important;
}
.backdrop-blur {
--tw-backdrop-blur: blur(8px);
-webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
}
.backdrop-grayscale {
--tw-backdrop-grayscale: grayscale(100%);
-webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
}
.backdrop-invert {
--tw-backdrop-invert: invert(100%);
-webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
}
.backdrop-sepia {
--tw-backdrop-sepia: sepia(100%);
-webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
}
.backdrop-filter {
-webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
}
.transition-colors {
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
@ -2436,6 +2736,10 @@ a.link-underline {
}
@media (min-width: 640px) {
.sm\:top-3 {
top: 0.75rem;
}
.sm\:m-2 {
margin: 0.5rem;
}
@ -2474,18 +2778,40 @@ a.link-underline {
height: 6rem;
}
.sm\:w-fit {
width: -webkit-fit-content;
width: -moz-fit-content;
width: fit-content;
}
.sm\:w-24 {
width: 6rem;
}
.sm\:max-w-sm {
max-width: 24rem;
}
.sm\:max-w-xl {
max-width: 36rem;
}
.sm\:flex-row {
flex-direction: row;
}
.sm\:flex-wrap {
flex-wrap: wrap;
}
.sm\:flex-nowrap {
flex-wrap: nowrap;
}
.sm\:items-start {
align-items: flex-start;
}
.sm\:items-stretch {
align-items: stretch;
}
@ -2506,6 +2832,10 @@ a.link-underline {
padding: 0.5rem;
}
.sm\:pl-0 {
padding-left: 0px;
}
.sm\:pt-1 {
padding-top: 0.25rem;
}
@ -2551,10 +2881,6 @@ a.link-underline {
margin-top: 1rem;
}
.md\:flex {
display: flex;
}
.md\:grid {
display: grid;
}
@ -2575,7 +2901,7 @@ a.link-underline {
width: 2rem;
}
.md\:w-2\/6 {
.md\:w-1\/3 {
width: 33.333333%;
}
@ -2603,10 +2929,6 @@ a.link-underline {
flex-wrap: nowrap;
}
.md\:border-t-2 {
border-top-width: 2px;
}
.md\:p-6 {
padding: 1.5rem;
}
@ -2644,10 +2966,6 @@ a.link-underline {
width: 75%;
}
.lg\:w-1\/6 {
width: 16.666667%;
}
.lg\:w-5\/12 {
width: 41.666667%;
}