Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ yarn-error.log
docs
.eslintcache
tsconfig.tsbuildinfo
*.env*
*.env*
.jest-cache
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,13 @@
"titleBar.inactiveBackground": "#61dafb99",
"titleBar.inactiveForeground": "#15202b99"
},
"peacock.color": "#61dafb"
"peacock.color": "#61dafb",
"editor.formatOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"mdx"
]
}
5 changes: 5 additions & 0 deletions __mocks__/dompurify.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const DOMPurify = {
sanitize: (html: string) => html,
}

export default DOMPurify
7 changes: 7 additions & 0 deletions __mocks__/react-ripples.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react'

const Ripples = ({ children }: { children: React.ReactNode }) => {
return <>{children}</>
}

export default Ripples
10 changes: 9 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ module.exports = {
setupFilesAfterEnv: ['<rootDir>/src/test/jest-setup.ts'],
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
roots: ['<rootDir>'],
maxWorkers: '50%',
cacheDirectory: '<rootDir>/.jest-cache',
globals: {
'ts-jest': {
diagnostics: false,
isolatedModules: true,
},
},
modulePaths: tsConfig.compilerOptions ? [tsConfig.compilerOptions.baseUrl] : [],
moduleNameMapper: {
...(tsConfig.compilerOptions && tsConfig.compilerOptions.paths
Expand All @@ -18,4 +26,4 @@ module.exports = {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/__mocks__/fileMock.js',
'\\.(css)$': 'identity-obj-proxy'
}
};
};
116 changes: 116 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@
"@emotion/react": "11.8.2",
"@emotion/styled": "11.8.1",
"date-fns": "^4.1.0",
"dompurify": "^3.3.1",
"framer-motion": "6.2.8",
"html-react-parser": "^5.2.11",
"react-hot-toast": "2.4.1",
"react-ripples": "2.2.1"
},
Expand All @@ -137,4 +139,4 @@
"@types/react-dom": "17.0.2"
},
"sideEffects": false
}
}
2 changes: 1 addition & 1 deletion src/atoms/Icons/Base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface BaseProps {
}
interface IconProps extends BaseProps {
viewBox?: string
children: React.ReactChild | React.ReactChild[]
children: React.ReactNode
title?: string
}

Expand Down
7 changes: 5 additions & 2 deletions src/atoms/Label/Label.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { Box } from '@chakra-ui/react'
import { Box, CSSObject } from '@chakra-ui/react'

import { vars } from '@theme'

export interface LabelProps {
children: React.ReactChild
children: React.ReactNode
bg?: string
color?: string
size?: 'md' | 'sm'
m?: string
sx?: CSSObject
}

/**
Expand All @@ -20,6 +21,7 @@ export function Label({
color = vars('colors-neutral-darkCharcoal'),
size = 'md',
m = '0',
sx,
}: LabelProps): JSX.Element {
const config = {
md: {
Expand All @@ -45,6 +47,7 @@ export function Label({
lineHeight=".875rem"
m={m}
p={config[size].p}
sx={sx}
>
{children}
</Box>
Expand Down
6 changes: 4 additions & 2 deletions src/atoms/TinyAlert/TinyAlert.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box } from '@chakra-ui/react'
import { Box, CSSObject } from '@chakra-ui/react'
import { vars } from '@theme'

import { TinyAlertInfo, TinyAlertError, TinyAlertWarning, TinyAlertSuccess } from '../Icons'
Expand All @@ -7,6 +7,7 @@ export interface props {
status: 'success' | 'error' | 'info' | 'warning' | 'answered' | 'pending' | 'omitted' | 'new'
text?: string
margin?: string
sx?: CSSObject
}

/**
Expand All @@ -16,7 +17,7 @@ export interface props {
* <TinyAlert status="info" />
*/

export function TinyAlert({ status, text, margin = '0' }: props): JSX.Element | null {
export function TinyAlert({ status, text, margin = '0', sx }: props): JSX.Element | null {
const alerts = {
success: {
icon: <TinyAlertSuccess />,
Expand Down Expand Up @@ -84,6 +85,7 @@ export function TinyAlert({ status, text, margin = '0' }: props): JSX.Element |
width="fit-content"
borderRadius=".25rem"
className="TinyAlert-Box"
sx={sx}
>
{alerts[status].icon && (
<Box
Expand Down
2 changes: 2 additions & 0 deletions src/documentation/Documentation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { routes } from './utils/routes'
import { Home, NoMatch } from './pages'
import { Layout } from './components'
import { Box } from '@chakra-ui/react'
import { FlashNotificationGlobal } from '@/organisms/Alerts/FlashNotification'

export const Documentation = (): JSX.Element => {
React.useEffect(() => {
Expand All @@ -16,6 +17,7 @@ export const Documentation = (): JSX.Element => {

return (
<Box w="100%" overflowX="hidden">
<FlashNotificationGlobal />
<BrowserRouter>
<Routes>
<Route path="/" element={<Layout />}>
Expand Down
10 changes: 3 additions & 7 deletions src/documentation/components/FlashNotificationDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,16 @@ import { Box, Button } from '@chakra-ui/react'
export default function FlashNotificationDemo({
state,
message,
maxContent,
}: IFlashNotificationProps): JSX.Element {
const { show, active, config } = useFlashNotification({
state: state,
message: message,
maxContent: maxContent,
})
return (
<Box>
<Button
onClick={() => {
active()
}}
>
{state}
</Button>
<Button onClick={active}>{state}</Button>
<FlashNotification {...config} show={show} />
</Box>
)
Expand Down
2 changes: 1 addition & 1 deletion src/documentation/pages/Organisms/Alerts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export const ViewAlert = (): JSX.Element => {
<MyText>Tipos implementados en el Alert</MyText>
<Code
text={`interface IAlertProps {
children?: React.ReactChild | React.ReactChild[]
children?: React.ReactNode
canDismiss?: boolean // Muestra el botón para cerrar
buttonText?: string // Texto del botón
buttonIcon?: React.ReactElement // Ícono del botón
Expand Down
6 changes: 5 additions & 1 deletion src/documentation/pages/Organisms/FlashNotification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ export const ViewFlashNotification = (): JSX.Element => {
<MyTitle>Estados</MyTitle>
<MyText>Existen 4 posibles estados que definen el ícono y color de la notificación.</MyText>
<ListComponent>
<FlashNotificationDemo state="info" message="Mensaje informativo" />
<FlashNotificationDemo
maxContent
state="info"
message="<b>¡Grupo creado!</b><br />Tu grupo ha sido creado. Ahora puedes invitar a tus compañeros."
/>
<FlashNotificationDemo state="success" message="Mensaje de éxito" />
<FlashNotificationDemo state="error" message="Mensaje de error" />
<FlashNotificationDemo state="warning" message="Mensaje de advertencia" />
Expand Down
Loading