mirror of
https://github.com/frappe/books.git
synced 2024-12-23 19:39:07 +00:00
fix(ui): center toasts
- wider toasts - narrower sidebar
This commit is contained in:
parent
da9c677fc2
commit
abdd26f662
@ -18,9 +18,6 @@
|
|||||||
@setup-complete="setupComplete"
|
@setup-complete="setupComplete"
|
||||||
@setup-canceled="setupCanceled"
|
@setup-canceled="setupCanceled"
|
||||||
/>
|
/>
|
||||||
<div id="toast-container" class="absolute bottom-0 right-0 mr-6 mb-3">
|
|
||||||
<div id="toast-target" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -27,11 +27,16 @@ const getValidColor = (color) => {
|
|||||||
export function getBgColorClass(color) {
|
export function getBgColorClass(color) {
|
||||||
return `bg-${getValidColor(color)}-100`;
|
return `bg-${getValidColor(color)}-100`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getColorClass(color, type, value = 300) {
|
||||||
|
return `${type}-${getValidColor(color)}-${value}`;
|
||||||
|
}
|
||||||
|
|
||||||
export function getTextColorClass(color) {
|
export function getTextColorClass(color) {
|
||||||
return `text-${getValidColor(color)}-600`;
|
return `text-${getValidColor(color)}-600`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getColorClass(color) {
|
export function getBgTextColorClass(color) {
|
||||||
const bg = getBgColorClass(color);
|
const bg = getBgColorClass(color);
|
||||||
const text = getTextColorClass(color);
|
const text = getTextColorClass(color);
|
||||||
return [bg, text].join(' ');
|
return [bg, text].join(' ');
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getColorClass } from '../colors';
|
import { getBgTextColorClass } from '../colors';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Badge',
|
name: 'Badge',
|
||||||
@ -16,7 +16,7 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
colorClass() {
|
colorClass() {
|
||||||
return getColorClass(this.color);
|
return getBgTextColorClass(this.color);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -2,16 +2,19 @@
|
|||||||
<div
|
<div
|
||||||
class="
|
class="
|
||||||
text-gray-900
|
text-gray-900
|
||||||
shadow-md
|
shadow-lg
|
||||||
px-3
|
px-3
|
||||||
py-2
|
py-2
|
||||||
rounded
|
rounded
|
||||||
flex
|
flex
|
||||||
items-center
|
items-center
|
||||||
mb-3
|
mb-3
|
||||||
w-80
|
w-96
|
||||||
|
z-10
|
||||||
|
bg-white
|
||||||
|
border-l-4
|
||||||
"
|
"
|
||||||
:class="bgColor + (actionText ? ' cursor-pointer' : '')"
|
:class="colorClass + (actionText ? ' cursor-pointer' : '')"
|
||||||
style="transition: opacity 150ms ease-in"
|
style="transition: opacity 150ms ease-in"
|
||||||
:style="{ opacity }"
|
:style="{ opacity }"
|
||||||
@click="action"
|
@click="action"
|
||||||
@ -30,7 +33,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getBgColorClass, getTextColorClass } from '../colors';
|
import { getColorClass } from '../colors';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@ -62,11 +65,11 @@ export default {
|
|||||||
success: 'green',
|
success: 'green',
|
||||||
}[this.type];
|
}[this.type];
|
||||||
},
|
},
|
||||||
bgColor() {
|
colorClass() {
|
||||||
return getBgColorClass(this.color);
|
return getColorClass(this.color, 'border', 300);
|
||||||
},
|
},
|
||||||
iconColor() {
|
iconColor() {
|
||||||
return getTextColorClass(this.color);
|
return getColorClass(this.color, 'text', 400);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex overflow-hidden">
|
<div class="flex overflow-hidden">
|
||||||
<Sidebar class="w-56 flex-shrink-0" @change-db-file="$emit('change-db-file')"/>
|
<Sidebar
|
||||||
|
class="w-48 flex-shrink-0"
|
||||||
|
@change-db-file="$emit('change-db-file')"
|
||||||
|
/>
|
||||||
<div class="flex flex-1 overflow-y-hidden bg-white">
|
<div class="flex flex-1 overflow-y-hidden bg-white">
|
||||||
<keep-alive>
|
<keep-alive>
|
||||||
<router-view class="flex-1" :key="$route.path" />
|
<router-view class="flex-1" :key="$route.path" />
|
||||||
@ -14,6 +17,13 @@
|
|||||||
/>
|
/>
|
||||||
</keep-alive>
|
</keep-alive>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
id="toast-container"
|
||||||
|
class="absolute bottom-0 flex flex-col items-center mb-3"
|
||||||
|
style="width: calc(100% - 12rem)"
|
||||||
|
>
|
||||||
|
<div id="toast-target" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -22,7 +32,7 @@ import Sidebar from '../components/Sidebar';
|
|||||||
export default {
|
export default {
|
||||||
name: 'Desk',
|
name: 'Desk',
|
||||||
components: {
|
components: {
|
||||||
Sidebar
|
Sidebar,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
showQuickEdit() {
|
showQuickEdit() {
|
||||||
@ -31,7 +41,7 @@ export default {
|
|||||||
this.$route.query.doctype &&
|
this.$route.query.doctype &&
|
||||||
this.$route.query.name
|
this.$route.query.name
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user