diff --git a/src/views/profile/creators/ColorsPicker.vue b/src/views/profile/creators/ColorsPicker.vue index b9631aa..6216bef 100644 --- a/src/views/profile/creators/ColorsPicker.vue +++ b/src/views/profile/creators/ColorsPicker.vue @@ -8,50 +8,99 @@ const props = defineProps({ }, colorName: { type: String, - default: 'bannerTop' + default: 'primary' } }); const emits = defineEmits(['closeRequested']); -const bannerTopColor = ref(props.creator.colors.bannerTop) -const bannerBottomColor = ref(props.creator.colors.bannerBottom) -const accentColor = ref(props.creator.colors.accent) -const menuColor = ref(props.creator.colors.menu) +const primaryColor = ref(props.creator.colors.primary) +const secondaryColor = ref(props.creator.colors.secondary) +const backgroundColor = ref(props.creator.colors.background) +const errorColor = ref(props.creator.colors.error) +const surfaceColor = ref(props.creator.colors.surface) +const onPrimaryColor = ref(props.creator.colors.onPrimary) +const onSecondaryColor = ref(props.creator.colors.onSecondary) +const onBackgroundColor = ref(props.creator.colors.onBackground) +const onErrorColor = ref(props.creator.colors.onError) +const onSurfaceColor = ref(props.creator.colors.onSurface) const selectedColorName = ref(props.colorName); -const selectedColor = computed({ +const selectedBackgroundColor = computed({ get() { switch (selectedColorName.value) { - case 'bannerTop': - return bannerTopColor.value; - case 'bannerBottom': - return bannerBottomColor.value; - case 'accent': - return accentColor.value; - case 'menu': - return menuColor.value; + case 'primary': + return primaryColor.value + case 'secondary': + return secondaryColor.value + case 'background': + return backgroundColor.value + case 'error': + return errorColor.value + case 'surface': + return surfaceColor.value default: - return bannerTopColor.value; + return '#e42aad'; } }, set(value) { switch (selectedColorName.value) { - case 'bannerTop': - bannerTopColor.value = value; - break; - case 'bannerBottom': - bannerBottomColor.value = value; - break; - case 'accent': - accentColor.value = value; - break; - case 'menu': - menuColor.value = value; - break; + case 'primary': + primaryColor.value = value + break + case 'secondary': + secondaryColor.value = value + break + case 'background': + backgroundColor.value = value + break + case 'error': + errorColor.value = value + break + case 'surface': + surfaceColor.value = value + break } } -}); +}) +const selectedTextColor = computed({ + get() { + switch (selectedColorName.value) { + case 'primary': + return onPrimaryColor.value + case 'secondary': + return onSecondaryColor.value + case 'background': + return onBackgroundColor.value + case 'error': + return onErrorColor.value + case 'surface': + return onSurfaceColor.value + default: + return '#e42aad'; + } + }, + set(value) { + switch (selectedColorName.value) { + case 'primary': + onPrimaryColor.value = value + break + case 'secondary': + onSecondaryColor.value = value + break + case 'background': + onBackgroundColor.value = value + break + case 'error': + onErrorColor.value = value + break + case 'surface': + onSurfaceColor.value = value + break + } + } +}) + const selectColor = (colorName) => { selectedColorName.value = colorName; @@ -63,16 +112,28 @@ const save = async () => { await client.post( `/api/creators/${props.creator.id}/colors`, { - "bannerTop": bannerTopColor.value || null, - "bannerBottom": bannerBottomColor.value || null, - "accent": accentColor.value || null, - "menu": menuColor.value || null + 'primary': primaryColor.value, + 'secondary': secondaryColor.value, + 'background': backgroundColor.value, + 'error': errorColor.value, + 'surface': surfaceColor.value, + 'onPrimary': onPrimaryColor.value, + 'onSecondary': onSecondaryColor.value, + 'onBackground': onBackgroundColor.value, + 'onError': onErrorColor.value, + 'onSurface': onSurfaceColor.value, }); - props.creator.colors.bannerTop = bannerTopColor.value; - props.creator.colors.bannerBottom = bannerBottomColor.value; - props.creator.colors.accent = accentColor.value; - props.creator.colors.menu = menuColor.value; + props.creator.colors.primary = primaryColor.value + props.creator.colors.secondary = secondaryColor.value + props.creator.colors.background = backgroundColor.value + props.creator.colors.error = errorColor.value + props.creator.colors.surface = surfaceColor.value + props.creator.colors.onPrimary = onPrimaryColor.value + props.creator.colors.onSecondary = onSecondaryColor.value + props.creator.colors.onBackground = onBackgroundColor.value + props.creator.colors.onError = onErrorColor.value + props.creator.colors.onSurface = onSurfaceColor.value emits('closeRequested'); } catch (error) { @@ -90,50 +151,76 @@ const cancel = () => { Palette de Couleurs -
- -
+
+ +
- Haut Banniere + + Primary +
- Bas Banniere + + Secondary +
- Accent + + Surface +
- Menu + + Background + +
+ +
+ + Error +
- -
- -
- + +
+ TEXT + + Background +
@@ -148,7 +235,7 @@ const cancel = () => { @apply w-[150px] h-[150px]; @apply flex rounded-md cursor-pointer relative; @apply items-center justify-center; - @apply font-bold text-white; + @apply font-bold text-2xl; } .color-square.selected {