mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-06-10 09:29:34 +00:00
dca01e6817
Fixes: https://github.com/woodpecker-ci/woodpecker/issues/1079 What do you think about using a consistent `woodpecker` color scheme? Right now, the `lime` color scheme from windicss is used that does not really fit the primary color used for the documentation website. I have used the primary color `#4CAF50` from the docs and created a color palette with https://palettte.app/: <details> <summary>JSON source</summary> ```Json [ { "paletteName": "New Palette", "swatches": [ { "name": "New Swatch", "color": "166E30" }, { "name": "New Swatch", "color": "248438" }, { "name": "New Swatch", "color": "369943" }, { "name": "New Swatch", "color": "4CAF50" }, { "name": "New Swatch", "color": "68C464" }, { "name": "New Swatch", "color": "8AD97F" } ] } ] ``` </details> ![image](https://github.com/woodpecker-ci/woodpecker/assets/3391958/a254f1e0-ce17-43a9-9e8b-72252296fd6f) I have added this color scheme to the windicss config and replaced the use of `lime` in the UI. While `woodpecker-300` would be the primary color that is used for the docs, I currently use `woodpecke-400` as primary color for the UI to fix some contrast issues. ![image](https://github.com/woodpecker-ci/woodpecker/assets/3391958/7bf751e1-f2a6-481c-bee7-a27d27cf8adb) ![image](https://github.com/woodpecker-ci/woodpecker/assets/3391958/e5673dc7-81c1-4fd4-bef9-14494bc5aa27) What do you think? If you would like to stay with the current colors, that's fine for me, I can just use the custom CSS feature in this case. --------- Co-authored-by: 6543 <6543@obermui.de>
123 lines
3.2 KiB
Vue
123 lines
3.2 KiB
Vue
<template>
|
|
<button
|
|
type="button"
|
|
class="relative flex items-center py-1 px-2 rounded-md border shadow-sm cursor-pointer transition-all duration-150 overflow-hidden disabled:opacity-50 disabled:cursor-not-allowed"
|
|
:class="{
|
|
'bg-wp-control-neutral-100 hover:bg-wp-control-neutral-200 border-wp-control-neutral-300 text-wp-text-100':
|
|
color === 'gray',
|
|
'bg-wp-control-ok-100 hover:bg-wp-control-ok-200 border-wp-control-ok-300 text-white': color === 'green',
|
|
'bg-wp-control-info-100 hover:bg-wp-control-info-200 border-wp-control-info-300 text-white': color === 'blue',
|
|
'bg-wp-control-error-100 hover:bg-wp-control-error-200 border-wp-control-error-300 text-white': color === 'red',
|
|
...passedClasses,
|
|
}"
|
|
:title="title"
|
|
:disabled="disabled"
|
|
@click="doClick"
|
|
>
|
|
<slot>
|
|
<Icon v-if="startIcon" :name="startIcon" class="!w-6 !h-6" :class="{ invisible: isLoading, 'mr-1': text }" />
|
|
<span :class="{ invisible: isLoading }">{{ text }}</span>
|
|
<Icon v-if="endIcon" :name="endIcon" class="ml-2 w-6 h-6" :class="{ invisible: isLoading }" />
|
|
<div
|
|
class="absolute left-0 top-0 right-0 bottom-0 flex items-center justify-center"
|
|
:class="{
|
|
'opacity-100': isLoading,
|
|
'opacity-0': !isLoading,
|
|
'bg-wp-control-neutral-200': color === 'gray',
|
|
'bg-wp-control-ok-200': color === 'green',
|
|
'bg-wp-control-info-200': color === 'blue',
|
|
'bg-wp-control-error-200': color === 'red',
|
|
}"
|
|
>
|
|
<Icon name="loading" class="animate-spin" />
|
|
</div>
|
|
</slot>
|
|
</button>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { computed, defineComponent, PropType } from 'vue';
|
|
import { RouteLocationRaw, useRouter } from 'vue-router';
|
|
|
|
import Icon, { IconNames } from '~/components/atomic/Icon.vue';
|
|
|
|
export default defineComponent({
|
|
name: 'Button',
|
|
|
|
components: { Icon },
|
|
|
|
props: {
|
|
text: {
|
|
type: String,
|
|
default: null,
|
|
},
|
|
|
|
title: {
|
|
type: String,
|
|
default: null,
|
|
},
|
|
|
|
disabled: {
|
|
type: Boolean,
|
|
required: false,
|
|
},
|
|
|
|
to: {
|
|
type: [String, Object, null] as PropType<RouteLocationRaw | null>,
|
|
default: null,
|
|
},
|
|
|
|
color: {
|
|
type: String as PropType<'blue' | 'green' | 'red' | 'gray'>,
|
|
default: 'gray',
|
|
},
|
|
|
|
startIcon: {
|
|
type: String as PropType<IconNames | null>,
|
|
default: null,
|
|
},
|
|
|
|
endIcon: {
|
|
type: String as PropType<IconNames | null>,
|
|
default: null,
|
|
},
|
|
|
|
isLoading: {
|
|
type: Boolean,
|
|
},
|
|
},
|
|
|
|
setup(props, { attrs }) {
|
|
const router = useRouter();
|
|
|
|
async function doClick() {
|
|
if (props.isLoading) {
|
|
return;
|
|
}
|
|
|
|
if (!props.to) {
|
|
return;
|
|
}
|
|
|
|
if (typeof props.to === 'string' && props.to.startsWith('http')) {
|
|
window.location.href = props.to;
|
|
return;
|
|
}
|
|
|
|
await router.push(props.to);
|
|
}
|
|
|
|
const passedClasses = computed(() => {
|
|
const classes: Record<string, boolean> = {};
|
|
const origClass = (attrs.class as string) || '';
|
|
origClass.split(' ').forEach((c) => {
|
|
classes[c] = true;
|
|
});
|
|
return classes;
|
|
});
|
|
|
|
return { doClick, passedClasses };
|
|
},
|
|
});
|
|
</script>
|