Skip to content

Commit 4589144

Browse files
committed
Pass is_home_active to use_dimmed_icons hook to reset dimmed icon state
- going from home to main, should reset the timer on discord/donate buttons, and make them alt immediately └── apps └── editor └── src └── views └── prompt └── frontend ├── Home │ ├── Home.tsx │ └── index.ts ├── Prompt.tsx ├── components │ └── Layout │ ├── Footer │ │ ├── Footer.module.scss │ │ ├── Footer.tsx │ │ ├── hooks │ │ │ └── use-dimmed-icons.ts │ │ └── index.ts │ └── Layout.tsx └── hooks └── use-prompt └── use-prompt.ts
1 parent 114838e commit 4589144

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎apps/editor/src/views/prompt/frontend/components/Layout/Footer/Footer.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const Footer: React.FC<Props> = (props) => {
2929
clear_leave_timeout,
3030
handle_left_mouse_enter,
3131
handle_footer_mouse_leave
32-
} = use_dimmed_icons()
32+
} = use_dimmed_icons(props.is_home_active)
3333

3434
const is_alt_style = is_alt && !props.is_home_active
3535

‎apps/editor/src/views/prompt/frontend/components/Layout/Footer/hooks/use-dimmed-icons.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useEffect, useRef, useState } from 'react'
22

33
const DIMMED_ICONS_TIMEOUT = 1000
44

5-
export const use_dimmed_icons = () => {
5+
export const use_dimmed_icons = (is_home_active?: boolean) => {
66
const [is_alt, set_is_alt] = useState(true)
77
const leave_timeout_ref = useRef<ReturnType<typeof setTimeout> | null>(null)
88

@@ -24,6 +24,13 @@ export const use_dimmed_icons = () => {
2424
}, DIMMED_ICONS_TIMEOUT)
2525
}
2626

27+
useEffect(() => {
28+
if (!is_home_active) {
29+
clear_leave_timeout()
30+
set_is_alt(true)
31+
}
32+
}, [is_home_active])
33+
2734
useEffect(() => {
2835
return () => {
2936
clear_leave_timeout()

0 commit comments

Comments
 (0)