-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(theme): β¨ Add chat theme settings
- Loading branch information
1 parent
619d10a
commit b0abe5b
Showing
37 changed files
with
769 additions
and
373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
apps/builder/components/theme/ChatSettings/ButtonsTheme.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Stack, Flex, Text } from '@chakra-ui/react' | ||
import { ContainerColors } from 'models' | ||
import React from 'react' | ||
import { ColorPicker } from '../GeneralSettings/ColorPicker' | ||
|
||
type Props = { | ||
buttons?: ContainerColors | ||
onButtonsChange: (buttons: ContainerColors) => void | ||
} | ||
|
||
const defaultBackgroundColor = '#0042da' | ||
const defaultTextColor = '#ffffff' | ||
|
||
export const ButtonsTheme = ({ buttons, onButtonsChange }: Props) => { | ||
const handleBackgroundChange = (backgroundColor: string) => | ||
onButtonsChange({ ...buttons, backgroundColor }) | ||
const handleTextChange = (color: string) => | ||
onButtonsChange({ ...buttons, color }) | ||
|
||
return ( | ||
<Stack> | ||
<Flex justify="space-between" align="center"> | ||
<Text>Background:</Text> | ||
<ColorPicker | ||
initialColor={buttons?.backgroundColor ?? defaultBackgroundColor} | ||
onColorChange={handleBackgroundChange} | ||
/> | ||
</Flex> | ||
<Flex justify="space-between" align="center"> | ||
<Text>Text:</Text> | ||
<ColorPicker | ||
initialColor={buttons?.color ?? defaultTextColor} | ||
onColorChange={handleTextChange} | ||
/> | ||
</Flex> | ||
</Stack> | ||
) | ||
} |
56 changes: 56 additions & 0 deletions
56
apps/builder/components/theme/ChatSettings/ChatThemeSettings.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { Heading, Stack } from '@chakra-ui/react' | ||
import { ChatTheme, ContainerColors, InputColors } from 'models' | ||
import React from 'react' | ||
import { ButtonsTheme } from './ButtonsTheme' | ||
import { GuestBubbles } from './GuestBubbles' | ||
import { HostBubbles } from './HostBubbles' | ||
import { InputsTheme } from './InputsTheme' | ||
|
||
type Props = { | ||
chatTheme?: ChatTheme | ||
onChatThemeChange: (chatTheme: ChatTheme) => void | ||
} | ||
|
||
export const ChatThemeSettings = ({ chatTheme, onChatThemeChange }: Props) => { | ||
const handleHostBubblesChange = (hostBubbles: ContainerColors) => | ||
onChatThemeChange({ ...chatTheme, hostBubbles }) | ||
const handleGuestBubblesChange = (guestBubbles: ContainerColors) => | ||
onChatThemeChange({ ...chatTheme, guestBubbles }) | ||
const handleButtonsChange = (buttons: ContainerColors) => | ||
onChatThemeChange({ ...chatTheme, buttons }) | ||
const handleInputsChange = (inputs: InputColors) => | ||
onChatThemeChange({ ...chatTheme, inputs }) | ||
|
||
return ( | ||
<Stack spacing={6}> | ||
<Stack borderWidth={1} rounded="md" p="4" spacing={4}> | ||
<Heading fontSize="lg">Bot bubbles</Heading> | ||
<HostBubbles | ||
hostBubbles={chatTheme?.hostBubbles} | ||
onHostBubblesChange={handleHostBubblesChange} | ||
/> | ||
</Stack> | ||
<Stack borderWidth={1} rounded="md" p="4" spacing={4}> | ||
<Heading fontSize="lg">User bubbles</Heading> | ||
<GuestBubbles | ||
guestBubbles={chatTheme?.guestBubbles} | ||
onGuestBubblesChange={handleGuestBubblesChange} | ||
/> | ||
</Stack> | ||
<Stack borderWidth={1} rounded="md" p="4" spacing={4}> | ||
<Heading fontSize="lg">Buttons</Heading> | ||
<ButtonsTheme | ||
buttons={chatTheme?.buttons} | ||
onButtonsChange={handleButtonsChange} | ||
/> | ||
</Stack> | ||
<Stack borderWidth={1} rounded="md" p="4" spacing={4}> | ||
<Heading fontSize="lg">Inputs</Heading> | ||
<InputsTheme | ||
inputs={chatTheme?.inputs} | ||
onInputsChange={handleInputsChange} | ||
/> | ||
</Stack> | ||
</Stack> | ||
) | ||
} |
37 changes: 37 additions & 0 deletions
37
apps/builder/components/theme/ChatSettings/GuestBubbles.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Stack, Flex, Text } from '@chakra-ui/react' | ||
import { ContainerColors } from 'models' | ||
import React from 'react' | ||
import { ColorPicker } from '../GeneralSettings/ColorPicker' | ||
|
||
type Props = { | ||
guestBubbles?: ContainerColors | ||
onGuestBubblesChange: (hostBubbles: ContainerColors) => void | ||
} | ||
|
||
const defaultBackgroundColor = '#ff8e21' | ||
const defaultTextColor = '#ffffff' | ||
export const GuestBubbles = ({ guestBubbles, onGuestBubblesChange }: Props) => { | ||
const handleBackgroundChange = (backgroundColor: string) => | ||
onGuestBubblesChange({ ...guestBubbles, backgroundColor }) | ||
const handleTextChange = (color: string) => | ||
onGuestBubblesChange({ ...guestBubbles, color }) | ||
|
||
return ( | ||
<Stack> | ||
<Flex justify="space-between" align="center"> | ||
<Text>Background:</Text> | ||
<ColorPicker | ||
initialColor={guestBubbles?.backgroundColor ?? defaultBackgroundColor} | ||
onColorChange={handleBackgroundChange} | ||
/> | ||
</Flex> | ||
<Flex justify="space-between" align="center"> | ||
<Text>Text:</Text> | ||
<ColorPicker | ||
initialColor={guestBubbles?.color ?? defaultTextColor} | ||
onColorChange={handleTextChange} | ||
/> | ||
</Flex> | ||
</Stack> | ||
) | ||
} |
38 changes: 38 additions & 0 deletions
38
apps/builder/components/theme/ChatSettings/HostBubbles.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Stack, Flex, Text } from '@chakra-ui/react' | ||
import { ContainerColors } from 'models' | ||
import React from 'react' | ||
import { ColorPicker } from '../GeneralSettings/ColorPicker' | ||
|
||
type Props = { | ||
hostBubbles?: ContainerColors | ||
onHostBubblesChange: (hostBubbles: ContainerColors) => void | ||
} | ||
|
||
const defaultBackgroundColor = '#f7f8ff' | ||
const defaultTextColor = '#303235' | ||
|
||
export const HostBubbles = ({ hostBubbles, onHostBubblesChange }: Props) => { | ||
const handleBackgroundChange = (backgroundColor: string) => | ||
onHostBubblesChange({ ...hostBubbles, backgroundColor }) | ||
const handleTextChange = (color: string) => | ||
onHostBubblesChange({ ...hostBubbles, color }) | ||
|
||
return ( | ||
<Stack> | ||
<Flex justify="space-between" align="center"> | ||
<Text>Background:</Text> | ||
<ColorPicker | ||
initialColor={hostBubbles?.backgroundColor ?? defaultBackgroundColor} | ||
onColorChange={handleBackgroundChange} | ||
/> | ||
</Flex> | ||
<Flex justify="space-between" align="center"> | ||
<Text>Text:</Text> | ||
<ColorPicker | ||
initialColor={hostBubbles?.color ?? defaultTextColor} | ||
onColorChange={handleTextChange} | ||
/> | ||
</Flex> | ||
</Stack> | ||
) | ||
} |
48 changes: 48 additions & 0 deletions
48
apps/builder/components/theme/ChatSettings/InputsTheme.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { Stack, Flex, Text } from '@chakra-ui/react' | ||
import { InputColors } from 'models' | ||
import React from 'react' | ||
import { ColorPicker } from '../GeneralSettings/ColorPicker' | ||
|
||
type Props = { | ||
inputs?: InputColors | ||
onInputsChange: (buttons: InputColors) => void | ||
} | ||
|
||
const defaultBackgroundColor = '#ffffff' | ||
const defaultTextColor = '#303235' | ||
const defaultPlaceholderColor = '#9095A0' | ||
|
||
export const InputsTheme = ({ inputs, onInputsChange }: Props) => { | ||
const handleBackgroundChange = (backgroundColor: string) => | ||
onInputsChange({ ...inputs, backgroundColor }) | ||
const handleTextChange = (color: string) => | ||
onInputsChange({ ...inputs, color }) | ||
const handlePlaceholderChange = (placeholderColor: string) => | ||
onInputsChange({ ...inputs, placeholderColor }) | ||
|
||
return ( | ||
<Stack> | ||
<Flex justify="space-between" align="center"> | ||
<Text>Background:</Text> | ||
<ColorPicker | ||
initialColor={inputs?.backgroundColor ?? defaultBackgroundColor} | ||
onColorChange={handleBackgroundChange} | ||
/> | ||
</Flex> | ||
<Flex justify="space-between" align="center"> | ||
<Text>Text:</Text> | ||
<ColorPicker | ||
initialColor={inputs?.color ?? defaultTextColor} | ||
onColorChange={handleTextChange} | ||
/> | ||
</Flex> | ||
<Flex justify="space-between" align="center"> | ||
<Text>Placeholder text:</Text> | ||
<ColorPicker | ||
initialColor={inputs?.placeholderColor ?? defaultPlaceholderColor} | ||
onColorChange={handlePlaceholderChange} | ||
/> | ||
</Flex> | ||
</Stack> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { ChatThemeSettings } from './ChatThemeSettings' |
64 changes: 0 additions & 64 deletions
64
apps/builder/components/theme/GeneralContent/GeneralContent.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 10 additions & 18 deletions
28
...BackgroundSelector/BackgroundSelector.tsx β ...BackgroundSelector/BackgroundSelector.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.