Skip to content

Commit

Permalink
fix: hedgehog mode meets dark mode badly (#17369)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra authored Sep 10, 2023
1 parent ae0898c commit 0747e00
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const TheHedgehog: StoryFn<typeof HedgehogBuddy> = () => {
// eslint-disable-next-line no-console
console.log('should close')
}}
isDarkModeOn={false}
/>
</div>
)
Expand Down
12 changes: 9 additions & 3 deletions frontend/src/lib/components/HedgehogBuddy/HedgehogBuddy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -390,17 +390,18 @@ export function HedgehogBuddy({
onClick: _onClick,
onPositionChange,
popoverOverlay,
isDarkModeOn,
}: {
actorRef?: MutableRefObject<HedgehogActor | undefined>
onClose: () => void
onClick?: () => void
onPositionChange?: (actor: HedgehogActor) => void
popoverOverlay?: React.ReactNode
// passed in because toolbar needs to check this differently than the app
isDarkModeOn: boolean
}): JSX.Element {
const actorRef = useRef<HedgehogActor>()

const { isDarkModeOn } = useValues(themeLogic)

if (!actorRef.current) {
actorRef.current = new HedgehogActor()
if (_actorRef) {
Expand Down Expand Up @@ -538,6 +539,11 @@ export function HedgehogBuddy({
export function HedgehogBuddyWithLogic(): JSX.Element {
const { hedgehogModeEnabled } = useValues(hedgehogbuddyLogic)
const { setHedgehogModeEnabled } = useActions(hedgehogbuddyLogic)
const { isDarkModeOn } = useValues(themeLogic)

return hedgehogModeEnabled ? <HedgehogBuddy onClose={() => setHedgehogModeEnabled(false)} /> : <></>
return hedgehogModeEnabled ? (
<HedgehogBuddy onClose={() => setHedgehogModeEnabled(false)} isDarkModeOn={isDarkModeOn} />
) : (
<></>
)
}
1 change: 1 addition & 0 deletions frontend/src/toolbar/button/HedgehogButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export function HedgehogButton(): JSX.Element {
onPositionChange={(actor) => {
saveDragPosition(actor.x + SPRITE_SIZE * 0.5, -actor.y - SPRITE_SIZE * 0.5)
}}
isDarkModeOn={false}
/>
)}
</>
Expand Down

0 comments on commit 0747e00

Please sign in to comment.