wca-designsystem 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.6",
2
+ "version": "0.0.7",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -15,7 +15,7 @@ export const Primary: Story = {
15
15
  args: {
16
16
  links: LinksDinamicosMock,
17
17
  isNavHover: true,
18
- setIsNavHover: (state) => console.log(state),
18
+ modulo: 'exemplo',
19
19
  notificacoes: {
20
20
  abre: true,
21
21
  notificacao: {
@@ -25,6 +25,8 @@ describe('AppShelCollapsed rendering', () => {
25
25
 
26
26
  const { getByTestId } = render(
27
27
  <ConchaAplicacao
28
+ isNavHover={true}
29
+ modulo="exemplo"
28
30
  notificacoes={mockNotifications}
29
31
  links={LinksDinamicosMock}
30
32
  >
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useRef } from 'react';
1
+ import React from 'react';
2
2
  import { Container } from '@mantine/core';
3
3
  import * as S from './styles';
4
4
  import Navbar from '../Navbar';
@@ -11,45 +11,21 @@ type ConchaAplicacaolType = {
11
11
  children: React.ReactNode;
12
12
  notificacoes: NotificationsProps;
13
13
  links?: LinksProps[];
14
+ modulo: string;
14
15
  isNavHover: boolean;
15
- setIsNavHover: React.Dispatch<React.SetStateAction<boolean>>;
16
+ navbarRef?: React.RefObject<HTMLDivElement>;
16
17
  };
17
18
  export function ConchaAplicacao({
18
19
  children,
20
+ modulo,
19
21
  isNavHover,
20
- setIsNavHover,
21
22
  notificacoes,
22
23
  links,
24
+ navbarRef,
23
25
  }: ConchaAplicacaolType) {
24
- const NavbarRef = useRef<HTMLDivElement>(null);
25
26
  const rotaAcessada = useLocation();
26
27
  const paginaAtual = rotaAcessada.pathname.replace('/', '');
27
28
 
28
- useEffect(() => {
29
- const handleMouseEnter = () => {
30
- setIsNavHover(true);
31
- };
32
-
33
- const handleMouseLeave = () => {
34
- setIsNavHover(false);
35
- };
36
-
37
- // Adiciona os listeners de evento quando o componente é montado
38
- const navbarRef = NavbarRef.current;
39
- if (navbarRef) {
40
- navbarRef.addEventListener('mouseenter', handleMouseEnter);
41
- navbarRef.addEventListener('mouseleave', handleMouseLeave);
42
- }
43
-
44
- // Remove os listeners de evento quando o componente é desmontado
45
- return () => {
46
- if (navbarRef) {
47
- navbarRef.removeEventListener('mouseenter', handleMouseEnter);
48
- navbarRef.removeEventListener('mouseleave', handleMouseLeave);
49
- }
50
- };
51
- }, []);
52
-
53
29
  return (
54
30
  <S.ConchaAplicacaoWrapper
55
31
  data-testid="app-shell-wrapper"
@@ -61,8 +37,8 @@ export function ConchaAplicacao({
61
37
  transitionTimingFunction="ease-in"
62
38
  transitionDuration={3}
63
39
  >
64
- <S.ConchaAplicacaoNavbarWrapper ref={NavbarRef} data-active={isNavHover}>
65
- <Navbar isHover={isNavHover} links={links} />
40
+ <S.ConchaAplicacaoNavbarWrapper ref={navbarRef} data-active={isNavHover}>
41
+ <Navbar modulo={modulo} isHover={isNavHover} links={links} />
66
42
  </S.ConchaAplicacaoNavbarWrapper>
67
43
  <S.ConchaAplicacaoMainWrapper>
68
44
  <Container fluid>
@@ -11,6 +11,7 @@ export default {
11
11
  const props = {
12
12
  isHover: true,
13
13
  links: LinksDinamicosMock,
14
+ module: 'Exemplo',
14
15
  };
15
16
 
16
17
  const Template: any = (args: NavbarType) => (
@@ -7,14 +7,14 @@ import { LinksDinamicosMock } from './mocks';
7
7
  describe('Navbar está renderizando corretamente', () => {
8
8
  test('Renderizando todos componentes internos', () => {
9
9
  const { getByTestId } = render(
10
- <Navbar isHover={false} links={LinksDinamicosMock} />
10
+ <Navbar modulo="exemplo" isHover={false} links={LinksDinamicosMock} />
11
11
  );
12
12
  expect(getByTestId('navbar')).toBeDefined();
13
13
  });
14
14
 
15
15
  test('Abre o navbar com hover', () => {
16
16
  const { getByTestId, queryByText } = render(
17
- <Navbar isHover={true} links={LinksDinamicosMock} />
17
+ <Navbar modulo="exemplo" isHover={true} links={LinksDinamicosMock} />
18
18
  );
19
19
 
20
20
  const FooterNavbar = queryByText('Precisa de ajuda');
@@ -11,15 +11,15 @@ import CiclosEncerrados from '../../../assets/imagens/icons/CiclosEncerrados.svg
11
11
  import Logo from '../../../assets/imagens/novos-icones/STI_nomeCor.svg';
12
12
  import LogoInitial from '../../../assets/imagens/novos-icones/STI_iconeBranco.svg';
13
13
  import { useMemo } from 'react';
14
- // import { LinksDinamicosMock } from './mocks';
15
14
  import { FadingComponent } from '../../atomos/FadeAnimacao';
16
15
  import AjudaIcone from '../../atomos/AjudaIcone';
17
16
 
18
17
  export type NavbarType = {
19
18
  isHover: boolean;
19
+ modulo: string;
20
20
  links?: LinksProps[];
21
21
  };
22
- const Navbar = ({ isHover, links }: NavbarType) => {
22
+ const Navbar = ({ isHover, links, modulo }: NavbarType) => {
23
23
  const LogoHeader = useMemo(() => (isHover ? Logo : LogoInitial), [isHover]);
24
24
 
25
25
  return (
@@ -57,7 +57,7 @@ const Navbar = ({ isHover, links }: NavbarType) => {
57
57
  <S.NabarBody>
58
58
  <NavbarTituloHeader
59
59
  isNavHover={isHover}
60
- modulo="Previsão de Vendas"
60
+ modulo={modulo}
61
61
  icon={CiclosEncerrados}
62
62
  />
63
63
  <GrupoDeLinks links={links} isNavHover={isHover} />
@@ -1,9 +1,9 @@
1
- import styled, { css } from "styled-components";
1
+ import styled, { css } from 'styled-components';
2
2
 
3
3
  export const CardInicialWrapper = styled.div`
4
4
  ${() => css`
5
5
  width: 320px;
6
- height: 332px;
6
+ height: 325px;
7
7
  border-radius: 8px;
8
8
  box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
9
9
  `}
@@ -26,14 +26,6 @@ const customRender = (
26
26
  },
27
27
  });
28
28
 
29
- // Criar um mock para o Zustand
30
- jest.mock('zustand', () => {
31
- return {
32
- create: jest.fn(() => () => {}),
33
- useStore: jest.fn(() => ({})), // Adicionando o useStore mock
34
- };
35
- });
36
-
37
29
  const Wrapper: React.FC = ({ children }: any) => (
38
30
  <QueryClientProvider client={queryClient}>
39
31
  <MantineProvider>