Skip to content

Commit 09f8942

Browse files
fix(PDYE-1297): se quita tooltip (#728)
Co-authored-by: Javiera Munita <javiera.munita@eclass.cl>
1 parent 5ad8f10 commit 09f8942

File tree

3 files changed

+36
-52
lines changed

3 files changed

+36
-52
lines changed

src/molecules/NavBarButtons/NavBarButton.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,28 @@ import { Accessibility } from '@/atoms/Icons/Accessibility'
77

88
/**
99
* Componente que muestra botones de la barra de navegación. Recibe los siguientes props:
10+
* @param {('button' | 'a' | 'div')} [as='button'] - Tipo de elemento HTML que se renderiza. Por defecto es un botón.
1011
* @param {string} [buttonName] - Nombre del botón. Si no se proporciona, se usa un valor predeterminado según el tipo de botón.
1112
* @param {boolean} [onlyLink] - Si es `true`, el botón no ejecuta ninguna acción al hacer clic, solo actúa como un enlace.
1213
* @param {function} onClick - Función que se ejecuta al hacer clic en el botón.
1314
* @param {'calendar' | 'help' | 'accessibility'} [type] - Tipo de botón que determina el icono y el texto a mostrar.
1415
*/
1516

1617
export interface ButtonProps {
18+
as?: 'button' | 'a' | 'div'
1719
buttonName?: string
1820
onlyLink?: boolean
19-
onClick: () => void
21+
onClick?: () => void
2022
type: 'calendar' | 'help' | 'accessibility'
2123
}
2224

23-
export const NavBarButton = ({ buttonName, onlyLink, onClick, type }: ButtonProps): JSX.Element => {
25+
export const NavBarButton = ({
26+
as = 'button',
27+
buttonName,
28+
onlyLink,
29+
onClick,
30+
type,
31+
}: ButtonProps): JSX.Element => {
2432
const buttonType = {
2533
accessibility: {
2634
icon: <Accessibility />,
@@ -49,7 +57,8 @@ export const NavBarButton = ({ buttonName, onlyLink, onClick, type }: ButtonProp
4957

5058
return (
5159
<Box
52-
as="button"
60+
as={as}
61+
className="nav-bar-button"
5362
id={isAccessibility ? 'UserWayButton' : ''}
5463
onClick={isAccessibility ? triggerWidget : onClick}
5564
sx={{

src/organisms/Calendar/Dropdown/CalendarDropdown/CalendarDropdownContainer.tsx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,8 @@ export const CalendarDropdownContainer = ({
2222
const [isMobile] = useMediaQuery('(max-width: 577px)')
2323
const { closeAndMarkSeen, empty, hasNew, hasMoreNext, ...all } = useParseEvents(events, now)
2424

25-
const [isTooltipDisabled, setTooltipDisabled] = useState(false)
2625
const [isMenuOpen, setMenuOpen] = useState(false)
2726

28-
// Resuelve tooltip que se mantiene visible al cerrar el menu
29-
useEffect(() => {
30-
if (isMenuOpen) {
31-
setTooltipDisabled(true)
32-
} else {
33-
const timer = setTimeout(() => setTooltipDisabled(false), 300)
34-
return () => clearTimeout(timer)
35-
}
36-
}, [isMenuOpen])
37-
3827
// Función que oculta el contenido de fondo al abrir el menú en formato mobile.
3928
// Para el caso de v8 se usa el id del contenedor y para CV la clase.
4029
// En ambos casos es un cambio que se aplica sólo cuando el menú está abierto y en dispositivos móviles.
@@ -147,7 +136,6 @@ export const CalendarDropdownContainer = ({
147136
<>
148137
<GoToCalendar
149138
text={text?.tooltip ?? 'Calendario'}
150-
tooltipDisabled={isTooltipDisabled}
151139
onlyToCalendar={onlyToCalendar}
152140
onClick={redirectToCalendar}
153141
/>
Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,43 @@
11
import { MenuButton } from '@chakra-ui/react'
22

33
import { vars } from '@theme'
4-
import { NavBarButton, NewTooltip } from '@/molecules'
4+
import { NavBarButton } from '@/molecules'
55

66
interface IGoToCalendar {
77
text: string
8-
tooltipDisabled: boolean
98
onlyToCalendar?: boolean
109
onClick?: () => void
1110
}
1211

13-
export const GoToCalendar = ({
14-
text,
15-
tooltipDisabled,
16-
onlyToCalendar,
17-
onClick,
18-
}: IGoToCalendar): JSX.Element => {
12+
export const GoToCalendar = ({ text, onlyToCalendar, onClick }: IGoToCalendar): JSX.Element => {
1913
const activeBg = vars('colors-main-deepSkyBlue') ?? '#0189FF'
2014
const hoverBg = 'rgba(96, 121, 142, 0.8)'
2115

2216
return (
23-
<NewTooltip
24-
label={text ?? 'Calendario'}
25-
m="2px 0 0 -59px"
26-
isDisabled={tooltipDisabled}
27-
transform="translateX(-10px) !important"
28-
>
29-
<MenuButton
30-
onClick={() => onlyToCalendar && onClick && onClick()}
31-
position="relative"
32-
sx={{
33-
_hover: {
34-
'.icon': {
35-
bg: hoverBg,
36-
},
37-
'.text': {
38-
color: vars('colors-neutral-white'),
39-
},
17+
<MenuButton
18+
onClick={() => onlyToCalendar && onClick && onClick()}
19+
position="relative"
20+
sx={{
21+
_hover: {
22+
'.icon': {
23+
bg: hoverBg,
24+
},
25+
'.text': {
26+
color: vars('colors-neutral-white'),
4027
},
28+
},
4129

42-
_active: {
43-
'.icon': {
44-
bg: onlyToCalendar ? hoverBg : activeBg,
45-
},
46-
'.text': {
47-
color: vars('colors-neutral-white'),
48-
},
30+
_active: {
31+
'.icon': {
32+
bg: onlyToCalendar ? hoverBg : activeBg,
4933
},
50-
}}
51-
>
52-
<NavBarButton type="calendar" onClick={() => {}} buttonName={text.toUpperCase()} />
53-
</MenuButton>
54-
</NewTooltip>
34+
'.text': {
35+
color: vars('colors-neutral-white'),
36+
},
37+
},
38+
}}
39+
>
40+
<NavBarButton as="div" type="calendar" buttonName={text.toUpperCase()} />
41+
</MenuButton>
5542
)
5643
}

0 commit comments

Comments
 (0)