Skip to content

Commit 518c546

Browse files
fix(PDYE-1136): ajustes visuales menu dropdown (#675)
Co-authored-by: Javiera Munita <javiera.munita@eclass.cl>
1 parent c914100 commit 518c546

File tree

13 files changed

+113
-144
lines changed

13 files changed

+113
-144
lines changed

package-lock.json

Lines changed: 31 additions & 105 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/organisms/Calendar/Dropdown/CalendarDropdown.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ export const CalendarDropdown = ({
88
now,
99
events,
1010
loading,
11+
m,
1112
}: ICalendarDropdown): JSX.Element => {
1213
const date = new Date(now)
1314
const isoDate = date.toISOString()
1415

1516
return (
1617
<CalendarDropdownContainer
18+
m={m}
1719
events={events}
1820
loading={loading}
1921
now={isoDate}

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

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const CalendarDropdownContainer = ({
1515
now,
1616
redirectToCalendar,
1717
courseColors: colors,
18+
m,
1819
}: ICalendarDropdown): JSX.Element => {
1920
const [isMobile] = useMediaQuery('(max-width: 577px)')
2021
const { closeAndMarkSeen, empty, hasNew, ...all } = useParseEvents(events, now)
@@ -32,6 +33,33 @@ export const CalendarDropdownContainer = ({
3233
}
3334
}, [isMenuOpen])
3435

36+
// Función que oculta el contenido de fondo al abrir el menú en formato mobile.
37+
// Para el caso de v8 se usa el id del contenedor y para CV la clase.
38+
// En ambos casos es un cambio que se aplica sólo cuando el menú está abierto y en dispositivos móviles.
39+
useEffect(() => {
40+
const viewContainer = document.getElementById('ViewContainer')
41+
42+
if (viewContainer) {
43+
// Si existe #ViewContainer, lo ocultamos o mostramos
44+
viewContainer.style.display = isMenuOpen ? 'none' : ''
45+
} else {
46+
// Si #ViewContainer no existe, aplicamos la lógica de .main
47+
const mainElement = document.querySelector('.main')
48+
if (!mainElement) return
49+
50+
const firstChild = mainElement.firstElementChild
51+
if (!firstChild || !(firstChild instanceof HTMLElement)) return
52+
53+
const headerElement = firstChild.querySelector('header.header')
54+
if (!headerElement) return
55+
56+
const targetElement = headerElement.nextElementSibling
57+
if (!targetElement || !(targetElement instanceof HTMLElement)) return
58+
59+
targetElement.style.display = isMenuOpen ? 'none' : ''
60+
}
61+
}, [isMenuOpen])
62+
3563
const onClose = (): void => {
3664
closeAndMarkSeen()
3765
setMenuOpen(false)
@@ -41,7 +69,7 @@ export const CalendarDropdownContainer = ({
4169
<Box
4270
zIndex={4}
4371
className="calendarDropdown"
44-
mr="24px"
72+
m={m}
4573
position="relative"
4674
sx={{
4775
'>div': {
@@ -57,6 +85,7 @@ export const CalendarDropdownContainer = ({
5785
width: isMobile ? '100vw' : '500px',
5886
maxHeight: isMobile ? 'calc(100vh - 62px)' : 'auto',
5987
overflowY: isMobile ? 'auto' : 'hidden',
88+
background: 'white',
6089
borderRadius: isMobile ? '0' : '10px',
6190
boxShadow: isMobile ? 'none' : 'rgba(47, 47, 47, 0.2) -1px 6px 40px 0px',
6291
animation: 'none !important',
@@ -66,6 +95,7 @@ export const CalendarDropdownContainer = ({
6695
},
6796
'.chakra-menu__group__title': {
6897
fontSize: '18px',
98+
fontWeight: '700',
6999
lineHeight: '31px',
70100
margin: '32px 0 0',
71101
padding: '0 0 8px 24px',

src/organisms/Calendar/Dropdown/CalendarDropdown/Components/Empty.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Box } from '@chakra-ui/react'
2+
import { vars } from '@theme'
23

34
import { NoEventsIcon } from '../Icons/NoEventsIcon'
45

@@ -12,7 +13,11 @@ export const Empty = ({ text }: { text?: string }): JSX.Element => {
1213
padding="104px 0px 64px"
1314
>
1415
<NoEventsIcon />
15-
<Box fontSize="20px" fontWeight={700} color="#2F2F2F">
16+
<Box
17+
fontSize="20px"
18+
fontWeight="700"
19+
color={vars('colors-neutral-darkCharcoal') || '#2F2F2F'}
20+
>
1621
{text ?? 'Aún no tienes eventos en tu calendario'}
1722
</Box>
1823
</Box>

src/organisms/Calendar/Dropdown/CalendarDropdown/Components/Events.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { BtnSecondary } from '@/molecules'
22
import { Box, MenuGroup } from '@chakra-ui/react'
33
import { Key } from 'react'
4+
import { vars } from '@theme'
45

56
import { EventsList } from '../../../EventsList/EventsList'
67
import { Text } from '../../types'
@@ -34,7 +35,7 @@ export const Events = ({
3435
pb="32px"
3536
sx={{
3637
'.calendar-events-group': {
37-
borderBottom: '1px solid #E8E8E8',
38+
borderBottom: `1px solid ${vars('colors-neutral-platinum')}` ?? '1px solid #E8E8E8',
3839
},
3940
}}
4041
>
@@ -50,7 +51,7 @@ export const Events = ({
5051
},
5152
}}
5253
>
53-
<BtnSecondary onClick={redirecToCalendar} m="72px 0 0 24px">
54+
<BtnSecondary onClick={redirecToCalendar} m="72px 0 0 24px" id="RedirectButton">
5455
{text?.buttonCalendar ?? 'Ir a Mi Calendario'}
5556
</BtnSecondary>
5657
</Box>
@@ -99,7 +100,7 @@ const EventsGroup = ({ title, events, text, colors }: EventsGroupProps): JSX.Ele
99100
className="calendar-events-group"
100101
_focus={{
101102
background: 'none !important',
102-
border: '1px solid #0189FF',
103+
border: `1px solid ${vars('colors-icon-deepSkyBlue')}` ?? '1px solid #0189FF',
103104
}}
104105
sx={{
105106
'.chakra-menu__menuitem > div': {
@@ -119,7 +120,7 @@ const EventsGroup = ({ title, events, text, colors }: EventsGroupProps): JSX.Ele
119120
}) => {
120121
return (
121122
<Box // Una vez que el evento se comporte como link, se debe cambiar Box a MenuItem y aplicar el efecto de focus
122-
bg="#FFFFFF"
123+
bg={vars('colors-neutral-white') ?? '#FFFFFF'}
123124
border="none"
124125
cursor="default"
125126
padding="0"

src/organisms/Calendar/Dropdown/CalendarDropdown/Components/GoToCalendar.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { MenuButton } from '@chakra-ui/react'
2+
import { vars } from '@theme'
23

34
import { CalendarButtonIcon } from '../Icons/CalendarButtonIcon'
45
import { NotificationIcon } from '../../../EventsList/NotificationIcon'
@@ -14,14 +15,15 @@ export const GoToCalendar = ({ hasNew, text, tooltipDisabled }: IGoToCalendar):
1415
return (
1516
<NewTooltip label={text ?? 'Calendario'} m="2px 0 0 0" isDisabled={tooltipDisabled}>
1617
<MenuButton
17-
background="#60798E"
18+
background={vars('colors-main-blueGrey') ?? '#60798E'}
1819
border="1px solid transparent"
1920
borderRadius="100%"
2021
height="30px"
2122
width="30px"
2223
position="relative"
2324
sx={{
2425
'>span': {
26+
lineHeight: '0',
2527
justifyItems: 'center',
2628
alignContent: 'center',
2729
},

src/organisms/Calendar/Dropdown/CalendarDropdown/Components/Header.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { Box } from '@chakra-ui/react'
2+
import { vars } from '@theme'
23

34
export const Header = ({ text, isMobile }: { text?: string; isMobile: boolean }): JSX.Element => {
45
return (
56
<>
67
<Box
78
as="header"
8-
bg="#5C5C5C"
9+
bg={vars('colors-neutral-davysGrey') ?? '#5C5C5C'}
910
borderRadius={isMobile ? 'none' : '10px 10px 0 0'}
10-
color="#FFFFFF"
11+
color={vars('colors-neutral-white') ?? '#FFFFFF'}
1112
fontSize="14px"
1213
fontWeight="500"
1314
lineHeight="normal"
@@ -22,7 +23,7 @@ export const Header = ({ text, isMobile }: { text?: string; isMobile: boolean })
2223
<Box
2324
className="arrow"
2425
aria-hidden
25-
borderBottom="12px solid #5C5C5C"
26+
borderBottom={`12px solid ${vars('colors-neutral-davysGrey')}` ?? '12px solid #5C5C5C'}
2627
borderLeft="14px solid transparent"
2728
borderRight="14px solid transparent"
2829
display={isMobile ? 'none' : 'block'}

src/organisms/Calendar/Dropdown/CalendarDropdown/Icons/CalendarButtonIcon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const CalendarButtonIcon = (): JSX.Element => (
2-
<svg width={16} height={16} fill="none">
2+
<svg width="16px" height="16px" fill="none">
33
<path
44
fill="#fff"
55
d="M15 2h-2V0h-2v2H9V0H7v2H5V0H3v2H1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1Zm-1 12H2V5h12v9Z"

0 commit comments

Comments
 (0)