Skip to content

Commit a7ae45a

Browse files
Feat/botones barra navegacion (#726)
* fix(PDYE-1284): componente para botones barra de navegacion --------- Co-authored-by: Javiera Munita <javiera.munita@eclass.cl>
1 parent 7d96113 commit a7ae45a

File tree

6 files changed

+113
-1
lines changed

6 files changed

+113
-1
lines changed

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export { BtnPrimary } from './molecules/Buttons/BtnPrimary'
1111
export { BtnSecondary } from './molecules/Buttons/BtnSecondary'
1212
export { BtnTertiary } from './molecules/Buttons/BtnTertiary'
1313
export { BtnLink } from './molecules/Buttons/BtnLink'
14+
export { NavBarButton } from './molecules/NavBarButtons/NavBarButton'
1415
export { NewTooltip } from './molecules/Tooltip/NewTooltip'
1516
export { UserWay } from './molecules/UserWay/UserWay'
1617
export { UserWayCookie } from './molecules/UserWay/UserWayCookie'
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export const HelpIcon = (): JSX.Element => {
2+
return (
3+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none">
4+
<path
5+
d="M8 0C3.6 0 0 3.6 0 8C0 12.4 3.6 16 8 16C12.4 16 16 12.4 16 8C16 3.6 12.4 0 8 0ZM8 13C7.448 13 7 12.552 7 12C7 11.448 7.448 11 8 11C8.552 11 9 11.448 9 12C9 12.552 8.552 13 8 13ZM9.623 8.092C9.126 8.519 9 8.663 9 9C9 9.553 8.552 10 8 10C7.448 10 7 9.553 7 9C7 7.706 7.795 7.024 8.322 6.573C8.819 6.148 8.945 6.003 8.945 5.667C8.945 5.484 8.945 5 8.001 5C7.565 5.024 7.1 5.224 6.743 5.561C6.342 5.939 5.708 5.92 5.329 5.52C4.95 5.118 4.968 4.485 5.37 4.106C6.072 3.445 6.987 3.052 7.949 3.002H7.952C9.764 3.002 10.945 4.073 10.945 5.668C10.945 6.961 10.15 7.643 9.624 8.093L9.623 8.092Z"
6+
fill="white"
7+
/>
8+
</svg>
9+
)
10+
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import { Box } from '@chakra-ui/react'
2+
3+
import { vars } from '@theme'
4+
import { HelpIcon } from '@/molecules/NavBarButtons/Icons/HelpIcon'
5+
import { CalendarButtonIcon } from './Icons/CalendarButtonIcon'
6+
import { Accessibility } from '@/atoms/Icons/Accessibility'
7+
8+
export interface ButtonProps {
9+
buttonName?: string
10+
onlyLink?: boolean
11+
onClick: () => void
12+
type: 'calendar' | 'help' | 'accessibility'
13+
}
14+
15+
export const NavBarButton = ({ buttonName, onlyLink, onClick, type }: ButtonProps): JSX.Element => {
16+
const buttonType = {
17+
accessibility: {
18+
icon: <Accessibility />,
19+
text: buttonName ?? 'ACCESIBILIDAD',
20+
},
21+
calendar: {
22+
icon: <CalendarButtonIcon />,
23+
text: buttonName ?? 'CALENDARIO',
24+
},
25+
help: {
26+
icon: <HelpIcon />,
27+
text: buttonName ?? 'AYUDA',
28+
},
29+
}
30+
31+
const triggerWidget = (): void => {
32+
const buttonB = document.getElementById('userWayTrigger')
33+
if (buttonB?.click) {
34+
buttonB.click() // Hace clic en el botón del archivo index.html
35+
}
36+
}
37+
38+
const activeBg = vars('colors-main-deepSkyBlue') ?? '#0189FF'
39+
const hoverBg = 'rgba(96, 121, 142, 0.8)'
40+
const isAccessibility = type === 'accessibility'
41+
42+
return (
43+
<Box
44+
as="button"
45+
id={isAccessibility ? 'UserWayButton' : ''}
46+
onClick={isAccessibility ? triggerWidget : onClick}
47+
sx={{
48+
display: 'flex',
49+
gap: '8px',
50+
h: '30px',
51+
maxH: '30px',
52+
53+
_hover: {
54+
'.icon': {
55+
bg: hoverBg,
56+
},
57+
'.text': {
58+
color: vars('colors-neutral-white'),
59+
},
60+
},
61+
62+
_active: {
63+
'.icon': {
64+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
65+
bg: onlyLink || isAccessibility ? hoverBg : activeBg,
66+
},
67+
'.text': {
68+
color: vars('colors-neutral-white'),
69+
},
70+
},
71+
72+
'.icon': {
73+
alignItems: 'center',
74+
bg: vars('colors-main-blueGrey'),
75+
borderRadius: '100%',
76+
border: '1px solid transparent',
77+
display: 'flex',
78+
height: '30px',
79+
justifyContent: 'center',
80+
type: 'button',
81+
role: 'button',
82+
width: '30px',
83+
},
84+
85+
'.text': {
86+
alignContent: 'center',
87+
fontSize: '12px',
88+
fontWeight: '500',
89+
forntFamily: 'Roboto',
90+
color: vars('colors-neutral-silverSand'),
91+
},
92+
}}
93+
>
94+
<Box className="icon">{buttonType[type].icon}</Box>
95+
<Box as="span" className="text">
96+
{buttonType[type].text}
97+
</Box>
98+
</Box>
99+
)
100+
}

src/molecules/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export { BtnPrimary } from './Buttons/BtnPrimary'
33
export { BtnSecondary } from './Buttons/BtnSecondary'
44
export { BtnTertiary } from './Buttons/BtnTertiary'
55
export { BtnLink } from './Buttons/BtnLink'
6+
export { NavBarButton } from './NavBarButtons/NavBarButton'
67
export { NewTooltip } from './Tooltip/NewTooltip'
78
export { UserWay } from './UserWay/UserWay'
89
export { UserWayCookie } from './UserWay/UserWayCookie'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { MenuButton } from '@chakra-ui/react'
22
import { vars } from '@theme'
33

4-
import { CalendarButtonIcon } from '../Icons/CalendarButtonIcon'
4+
import { CalendarButtonIcon } from '../../../../../molecules/NavBarButtons/Icons/CalendarButtonIcon'
55
import { NewTooltip } from '@/molecules'
66

77
interface IGoToCalendar {

0 commit comments

Comments
 (0)