Common button styles + added filter pagination UI.

This commit is contained in:
Fabio Manganiello 2025-02-23 21:14:56 +01:00
parent 0a1e6fcf19
commit 5738b1da60
3 changed files with 85 additions and 32 deletions
frontend/src

View file

@ -74,15 +74,34 @@
</div> </div>
</div> </div>
<div class="limit-container input-text-container"> <div class="pagination-container">
<label for="limit">Limit</label> <div class="page-button-container">
<input type="number" <button type="button"
id="limit" @click="$emit('prev-page')"
name="limit" title="Previous Results"
@input="newFilter.limit = Number($event.target.value)" :disabled="!hasPrev">
@change="newFilter.limit = Number($event.target.value)" <font-awesome-icon icon="fas fa-chevron-left" />
:value="newFilter.limit" </button>
min="1" /> </div>
<div class="limit-container">
<label for="limit">Max Results</label>
<input type="number"
id="limit"
name="limit"
@input="newFilter.limit = Number($event.target.value)"
@change="newFilter.limit = Number($event.target.value)"
:value="newFilter.limit"
min="1" />
</div>
<div class="page-button-container">
<button type="button"
@click="$emit('next-page')"
title="Next Results"
:disabled="!hasNext">
<font-awesome-icon icon="fas fa-chevron-right" />
</button>
</div>
</div> </div>
<div class="footer"> <div class="footer">
@ -95,9 +114,21 @@
import _ from 'lodash' import _ from 'lodash'
export default { export default {
emit: ['refresh'], emit: [
'next-page',
'prev-page',
'refresh',
],
props: { props: {
value: Object, value: Object,
hasPrev: {
type: Boolean,
default: true,
},
hasNext: {
type: Boolean,
default: true,
},
}, },
computed: { computed: {
@ -269,33 +300,31 @@ export default {
margin-top: 0.5em; margin-top: 0.5em;
button { button {
padding: 0.25em 0.5em;
margin-right: 0.25em; margin-right: 0.25em;
border: 1px solid var(--color-border);
border-radius: 0.25em;
background: var(--color-background);
font-size: 0.75em; font-size: 0.75em;
cursor: pointer;
&:disabled {
opacity: 0.5;
cursor: not-allowed;
}
&:hover {
color: var(--color-hover);
}
} }
} }
} }
} }
.input-text-container { .pagination-container {
display: flex; display: flex;
flex-direction: column; flex-direction: row;
justify-content: space-between;
align-items: center; align-items: center;
margin: 0.5em; margin: 0.5em;
.limit-container {
display: flex;
flex-direction: column;
align-items: center;
}
.page-button-container {
display: flex;
justify-content: center;
}
label { label {
margin-bottom: 0.25em; margin-bottom: 0.25em;
} }

View file

@ -1,5 +1,5 @@
<template> <template>
<button :class="{ 'selected': value }" <button class="toggle-button" :class="{ 'selected': value }"
@click="$emit('input')" @click="$emit('input')"
:title="title" :title="title"
:aria-pressed="value" :aria-pressed="value"
@ -24,11 +24,12 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
button { button.toggle-button {
background: var(--color-background); background: var(--color-background);
color: var(--color-text); color: var(--color-text);
width: 4em; width: 4em;
height: 4em; height: 4em;
font-size: 1em;
padding: 1.5em; padding: 1.5em;
outline: none; outline: none;
border: none; border: none;
@ -36,10 +37,6 @@ button {
box-shadow: 1px 1px 2px 2px var(--color-border); box-shadow: 1px 1px 2px 2px var(--color-border);
cursor: pointer; cursor: pointer;
&:hover {
color: var(--color-accent) !important;
}
&.selected { &.selected {
background: var(--color-accent); background: var(--color-accent);
color: var(--color-background); color: var(--color-background);

View file

@ -22,3 +22,30 @@ $screen-lg: 1200px;
@content; @content;
} }
} }
// Common element styles
button {
margin: 0 0.5em;
padding: 0.25em 0.5em;
border: 1px solid var(--color-border);
border-radius: 0.25em;
background: var(--color-background);
font-size: 1.25em;
cursor: pointer;
&:disabled {
opacity: 0.5;
cursor: not-allowed;
}
&:hover {
color: var(--color-hover);
}
}
button[type=submit] {
margin: 0.5em;
font-size: 1.15em;
padding: 0.5em;
}