72 lines
1.2 KiB
Vue
72 lines
1.2 KiB
Vue
<script setup lang="ts">
|
|
withDefaults(
|
|
defineProps<{
|
|
placeholder?: string
|
|
}>(),
|
|
{
|
|
placeholder: undefined,
|
|
},
|
|
)
|
|
|
|
const emit = defineEmits<{
|
|
create: [name: string]
|
|
}>()
|
|
|
|
const name = ref("")
|
|
|
|
function submit() {
|
|
const v = name.value.trim()
|
|
if (!v) return
|
|
emit("create", v)
|
|
name.value = ""
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<form class="create-row" @submit.prevent="submit">
|
|
<div class="field">
|
|
<Input
|
|
id="create-name"
|
|
v-model="name"
|
|
:placeholder="placeholder ?? $t('voyage.addRow.placeholder')"
|
|
full-width
|
|
/>
|
|
</div>
|
|
<button
|
|
type="submit"
|
|
class="add-btn"
|
|
:aria-label="$t('voyage.addRow.add')"
|
|
:title="$t('voyage.addRow.add')"
|
|
>
|
|
<Icon name="carbon:add" size="1.4rem" />
|
|
</button>
|
|
</form>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.create-row {
|
|
display: flex;
|
|
gap: 8px;
|
|
align-items: stretch;
|
|
}
|
|
|
|
.field {
|
|
flex: 1;
|
|
min-width: 0;
|
|
}
|
|
|
|
.add-btn {
|
|
flex-shrink: 0;
|
|
align-self: stretch;
|
|
width: 44px;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background: var(--color-5);
|
|
color: var(--primary-contrast);
|
|
border: 1.5px solid var(--color-5);
|
|
border-radius: var(--radius-md);
|
|
cursor: pointer;
|
|
box-shadow: var(--shadow-1);
|
|
}
|
|
</style>
|