Skip to content
Snippets Groups Projects
Unverified Commit 9e92eb6f authored by Aleksandr Lesnenko's avatar Aleksandr Lesnenko Committed by GitHub
Browse files

add metabot animation (#23448)

* add metabot animation

* review
parent 1870e9ef
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,7 @@ export const MetabotSettingWidgetRoot = styled.div` ...@@ -10,7 +10,7 @@ export const MetabotSettingWidgetRoot = styled.div`
`; `;
export const MetabotContainer = styled.div` export const MetabotContainer = styled.div`
padding: 2rem; padding: 0.5rem 1rem 0.75rem 1.25rem;
border-right: 1px solid ${color("border")}; border-right: 1px solid ${color("border")};
`; `;
......
...@@ -11,11 +11,18 @@ import { ...@@ -11,11 +11,18 @@ import {
import Toggle from "metabase/core/components/Toggle"; import Toggle from "metabase/core/components/Toggle";
const MetabotSettingWidget = ({ setting, onChange }: any) => { const MetabotSettingWidget = ({ setting, onChange }: any) => {
const isEnabled = setting.value ?? setting.defaultValue;
const metabotImage = isEnabled ? "metabot-happy" : "metabot-sad";
const toggleId = useUniqueId("show-metabot-switch"); const toggleId = useUniqueId("show-metabot-switch");
return ( return (
<MetabotSettingWidgetRoot> <MetabotSettingWidgetRoot>
<MetabotContainer> <MetabotContainer>
<MetabotLogo /> <img
src={`app/assets/img/${metabotImage}.gif`}
width="94px"
alt="Metabot"
/>
</MetabotContainer> </MetabotContainer>
<ToggleContainer> <ToggleContainer>
<ToggleLabel <ToggleLabel
...@@ -25,7 +32,7 @@ const MetabotSettingWidget = ({ setting, onChange }: any) => { ...@@ -25,7 +32,7 @@ const MetabotSettingWidget = ({ setting, onChange }: any) => {
id={toggleId} id={toggleId}
aria-checked={setting.value} aria-checked={setting.value}
role="switch" role="switch"
value={setting.value ?? setting.defaultValue} value={isEnabled}
onChange={onChange} onChange={onChange}
/> />
</ToggleContainer> </ToggleContainer>
......
resources/frontend_client/app/assets/img/metabot-happy.gif

55.8 KiB

resources/frontend_client/app/assets/img/metabot-sad.gif

47.7 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment