Added disabled button style
This commit is contained in:
@@ -13,6 +13,10 @@
|
|||||||
transition-duration: .2s;
|
transition-duration: .2s;
|
||||||
transition-timing-function: cubic-bezier(0.785, 0.135, 0.15, 0.86);
|
transition-timing-function: cubic-bezier(0.785, 0.135, 0.15, 0.86);
|
||||||
|
|
||||||
|
&:disabled {
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
&-secondary {
|
&-secondary {
|
||||||
&:not(:disabled) {
|
&:not(:disabled) {
|
||||||
background-color: var(--slate-200);
|
background-color: var(--slate-200);
|
||||||
@@ -23,6 +27,11 @@
|
|||||||
background-color: var(--blue-500);
|
background-color: var(--blue-500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:disabled {
|
||||||
|
color: var(--slate-500);
|
||||||
|
background-color: var(--slate-100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&-danger {
|
&-danger {
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onClickOutside, onLongPress, useCssVar, useFocus, useLocalStorage, useMouse, useTimeout, useTimeoutFn } from '@vueuse/core';
|
import { onClickOutside, onLongPress, useCssVar, useFocus, useLocalStorage, useMouse, useTimeout, useTimeoutFn } from '@vueuse/core'
|
||||||
import { computed, onMounted, onUnmounted, ref, watch } from 'vue';
|
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||||
|
|
||||||
const markerMenu = ref<HTMLMenuElement>();
|
const markerMenu = ref<HTMLMenuElement>()
|
||||||
|
|
||||||
type MenuMode = "editing-marker" | "default";
|
type MenuMode = "editing-marker" | "default"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Appearing behaviour
|
* Appearing behaviour
|
||||||
*/
|
*/
|
||||||
const isActive = ref<Boolean>(false)
|
const isActive = ref<Boolean>(false)
|
||||||
const shouldBeShown = computed(() => isActive.value)
|
const shouldBeShown = computed(() => isActive.value)
|
||||||
const currentMode = ref<MenuMode>("default");
|
const currentMode = ref<MenuMode>("default")
|
||||||
|
|
||||||
function switchMenuMode(newMode: MenuMode) {
|
function switchMenuMode(newMode: MenuMode) {
|
||||||
currentMode.value = newMode
|
currentMode.value = newMode
|
||||||
@@ -76,7 +76,6 @@ watch( isActive, (o, n) => {
|
|||||||
function updateMenuPosition() {
|
function updateMenuPosition() {
|
||||||
updateCSSVars()
|
updateCSSVars()
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateCSSVars() {
|
function updateCSSVars() {
|
||||||
mouseXVar.value = `${mouse.x.value.toFixed()}px`
|
mouseXVar.value = `${mouse.x.value.toFixed()}px`
|
||||||
mouseYVar.value = `${mouse.y.value.toFixed()}px`
|
mouseYVar.value = `${mouse.y.value.toFixed()}px`
|
||||||
@@ -105,7 +104,12 @@ watch(currentMode, (n, o) => {
|
|||||||
// Closes the menu if clicked outside
|
// Closes the menu if clicked outside
|
||||||
onClickOutside(markerMenu, handleClickOutside, { ignore: [markerModal] })
|
onClickOutside(markerMenu, handleClickOutside, { ignore: [markerModal] })
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Custom Marker
|
||||||
|
*/
|
||||||
function handleAddCustomMarker() {
|
function handleAddCustomMarker() {
|
||||||
|
if (!markerTitle.value) return
|
||||||
|
|
||||||
const addCustomMarkerEvent = new CustomEvent(`add-custom-marker`, { bubbles: true, detail: { title: markerTitle.value }})
|
const addCustomMarkerEvent = new CustomEvent(`add-custom-marker`, { bubbles: true, detail: { title: markerTitle.value }})
|
||||||
|
|
||||||
addCustomMarker.value?.dispatchEvent(addCustomMarkerEvent)
|
addCustomMarker.value?.dispatchEvent(addCustomMarkerEvent)
|
||||||
@@ -116,18 +120,28 @@ function handleAddCustomMarker() {
|
|||||||
markerTitle.value = ""
|
markerTitle.value = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide modal on cancel and resets
|
||||||
|
*/
|
||||||
function handleMarkerModalCancel() {
|
function handleMarkerModalCancel() {
|
||||||
showMenu()
|
showMenu()
|
||||||
hideMarkerModal()
|
hideMarkerModal()
|
||||||
switchMenuMode('default')
|
switchMenuMode('default')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display marker modal
|
||||||
|
*/
|
||||||
function showMarkerModal() {
|
function showMarkerModal() {
|
||||||
markerModal.value?.showModal()
|
markerModal.value?.showModal()
|
||||||
markerModalOpen.value = true
|
markerModalOpen.value = true
|
||||||
switchMenuMode('editing-marker')
|
switchMenuMode('editing-marker')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide marker modal
|
||||||
|
* TODO: Implement a timer for animation
|
||||||
|
*/
|
||||||
function hideMarkerModal() {
|
function hideMarkerModal() {
|
||||||
markerModal.value?.close()
|
markerModal.value?.close()
|
||||||
markerModalOpen.value = false
|
markerModalOpen.value = false
|
||||||
@@ -177,6 +191,7 @@ function hideMarkerModal() {
|
|||||||
ref="addCustomMarker"
|
ref="addCustomMarker"
|
||||||
type="submit"
|
type="submit"
|
||||||
class="btn btn-secondary"
|
class="btn btn-secondary"
|
||||||
|
:disabled="!markerTitle"
|
||||||
>
|
>
|
||||||
<span>Créer</span>
|
<span>Créer</span>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user