💄 Improve multiple choice color when image background
This commit is contained in:
@ -53,6 +53,8 @@ export const BackgroundContent = ({
|
|||||||
_hover={{ filter: 'brightness(.9)' }}
|
_hover={{ filter: 'brightness(.9)' }}
|
||||||
transition="filter 200ms"
|
transition="filter 200ms"
|
||||||
rounded="md"
|
rounded="md"
|
||||||
|
maxH="200px"
|
||||||
|
objectFit="cover"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Button>Select an image</Button>
|
<Button>Select an image</Button>
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
--typebot-header-bg-color: #ffffff;
|
--typebot-header-bg-color: #ffffff;
|
||||||
--typebot-header-color: #303235;
|
--typebot-header-color: #303235;
|
||||||
|
|
||||||
|
--selectable-base-alpha: 0;
|
||||||
|
|
||||||
--typebot-border-radius: 6px;
|
--typebot-border-radius: 6px;
|
||||||
|
|
||||||
/* Phone input */
|
/* Phone input */
|
||||||
@ -148,21 +150,41 @@ textarea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.typebot-selectable {
|
.typebot-selectable {
|
||||||
border: 1px solid rgba(var(--typebot-button-bg-color-rgb), 0.25);
|
border: 1px solid
|
||||||
|
rgba(
|
||||||
|
var(--typebot-button-bg-color-rgb),
|
||||||
|
calc(var(--selectable-base-alpha) + 0.25)
|
||||||
|
);
|
||||||
border-radius: var(--typebot-border-radius);
|
border-radius: var(--typebot-border-radius);
|
||||||
color: var(--typebot-container-color);
|
color: var(--typebot-container-color);
|
||||||
background-color: rgba(var(--typebot-button-bg-color-rgb), 0.08);
|
background-color: rgba(
|
||||||
|
var(--typebot-button-bg-color-rgb),
|
||||||
|
calc(var(--selectable-base-alpha) + 0.08)
|
||||||
|
);
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
|
backdrop-filter: blur(2px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.typebot-selectable:hover {
|
.typebot-selectable:hover {
|
||||||
background-color: rgba(var(--typebot-button-bg-color-rgb), 0.12);
|
background-color: rgba(
|
||||||
border-color: rgba(var(--typebot-button-bg-color-rgb), 0.3);
|
var(--typebot-button-bg-color-rgb),
|
||||||
|
calc(var(--selectable-base-alpha) + 0.12)
|
||||||
|
);
|
||||||
|
border-color: rgba(
|
||||||
|
var(--typebot-button-bg-color-rgb),
|
||||||
|
calc(var(--selectable-base-alpha) + 0.3)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
.typebot-selectable.selected {
|
.typebot-selectable.selected {
|
||||||
background-color: rgba(var(--typebot-button-bg-color-rgb), 0.18);
|
background-color: rgba(
|
||||||
border-color: rgba(var(--typebot-button-bg-color-rgb), 0.35);
|
var(--typebot-button-bg-color-rgb),
|
||||||
|
calc(var(--selectable-base-alpha) + 0.18)
|
||||||
|
);
|
||||||
|
border-color: rgba(
|
||||||
|
var(--typebot-button-bg-color-rgb),
|
||||||
|
calc(var(--selectable-base-alpha) + 0.35)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
.typebot-checkbox {
|
.typebot-checkbox {
|
||||||
@ -324,22 +346,41 @@ textarea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.typebot-selectable-picture {
|
.typebot-selectable-picture {
|
||||||
border: 1px solid rgba(var(--typebot-button-bg-color-rgb), 0.25);
|
border: 1px solid
|
||||||
|
rgba(
|
||||||
|
var(--typebot-button-bg-color-rgb),
|
||||||
|
calc(var(--selectable-base-alpha) + 0.25)
|
||||||
|
);
|
||||||
border-radius: var(--typebot-border-radius);
|
border-radius: var(--typebot-border-radius);
|
||||||
color: var(--typebot-container-color);
|
color: var(--typebot-container-color);
|
||||||
background-color: rgba(var(--typebot-button-bg-color-rgb), 0.08);
|
background-color: rgba(
|
||||||
|
var(--typebot-button-bg-color-rgb),
|
||||||
|
calc(var(--selectable-base-alpha) + 0.08)
|
||||||
|
);
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
width: 236px;
|
width: 236px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.typebot-selectable-picture:hover {
|
.typebot-selectable-picture:hover {
|
||||||
background-color: rgba(var(--typebot-button-bg-color-rgb), 0.12);
|
background-color: rgba(
|
||||||
border-color: rgba(var(--typebot-button-bg-color-rgb), 0.3);
|
var(--typebot-button-bg-color-rgb),
|
||||||
|
calc(var(--selectable-base-alpha) + 0.12)
|
||||||
|
);
|
||||||
|
border-color: rgba(
|
||||||
|
var(--typebot-button-bg-color-rgb),
|
||||||
|
calc(var(--selectable-base-alpha) + 0.3)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
.typebot-selectable-picture.selected {
|
.typebot-selectable-picture.selected {
|
||||||
background-color: rgba(var(--typebot-button-bg-color-rgb), 0.18);
|
background-color: rgba(
|
||||||
border-color: rgba(var(--typebot-button-bg-color-rgb), 0.35);
|
var(--typebot-button-bg-color-rgb),
|
||||||
|
calc(var(--selectable-base-alpha) + 0.18)
|
||||||
|
);
|
||||||
|
border-color: rgba(
|
||||||
|
var(--typebot-button-bg-color-rgb),
|
||||||
|
calc(var(--selectable-base-alpha) + 0.35)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
select option {
|
select option {
|
||||||
|
@ -39,6 +39,7 @@ const cssVariableNames = {
|
|||||||
checkbox: {
|
checkbox: {
|
||||||
bgColor: '--typebot-checkbox-bg-color',
|
bgColor: '--typebot-checkbox-bg-color',
|
||||||
color: '--typebot-checkbox-color',
|
color: '--typebot-checkbox-color',
|
||||||
|
baseAlpha: '--selectable-base-alpha',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} as const
|
} as const
|
||||||
@ -156,18 +157,30 @@ const setTypebotBackground = (
|
|||||||
: cssVariableNames.general.bgColor,
|
: cssVariableNames.general.bgColor,
|
||||||
parseBackgroundValue(background)
|
parseBackgroundValue(background)
|
||||||
)
|
)
|
||||||
const backgroundColor =
|
|
||||||
(BackgroundType.COLOR && isNotEmpty(background.content)
|
|
||||||
? background.content
|
|
||||||
: '#ffffff') ?? '#ffffff'
|
|
||||||
documentStyle.setProperty(
|
documentStyle.setProperty(
|
||||||
cssVariableNames.chat.checkbox.bgColor,
|
cssVariableNames.chat.checkbox.bgColor,
|
||||||
(BackgroundType.COLOR ? background.content : '#ffffff') ?? '#ffffff'
|
background?.type === BackgroundType.IMAGE
|
||||||
|
? 'rgba(255, 255, 255, 0.75)'
|
||||||
|
: (background?.type === BackgroundType.COLOR
|
||||||
|
? background.content
|
||||||
|
: '#ffffff') ?? '#ffffff'
|
||||||
)
|
)
|
||||||
|
const backgroundColor =
|
||||||
|
background.type === BackgroundType.IMAGE
|
||||||
|
? '#000000'
|
||||||
|
: background?.type === BackgroundType.COLOR &&
|
||||||
|
isNotEmpty(background.content)
|
||||||
|
? background.content
|
||||||
|
: '#ffffff'
|
||||||
documentStyle.setProperty(
|
documentStyle.setProperty(
|
||||||
cssVariableNames.general.color,
|
cssVariableNames.general.color,
|
||||||
isLight(backgroundColor) ? '#303235' : '#ffffff'
|
isLight(backgroundColor) ? '#303235' : '#ffffff'
|
||||||
)
|
)
|
||||||
|
if (background.type === BackgroundType.IMAGE) {
|
||||||
|
documentStyle.setProperty(cssVariableNames.chat.checkbox.baseAlpha, '0.40')
|
||||||
|
} else {
|
||||||
|
documentStyle.setProperty(cssVariableNames.chat.checkbox.baseAlpha, '0')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const parseBackgroundValue = ({ type, content }: Background) => {
|
const parseBackgroundValue = ({ type, content }: Background) => {
|
||||||
|
Reference in New Issue
Block a user