) => void;
8 | leftIcon?: React.ReactNode;
9 | rightIcon?: React.ReactNode;
10 | hint?: string;
11 | error?: string;
12 | disabled?: boolean;
13 | }
14 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/multi-function-button/MultiFunctionButton.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import styles from './MultiFunctionButton.module.scss';
3 | import type { IProps } from './types/IProps';
4 | import { Icon } from '../../../utils/svg-icons/icons';
5 |
6 | function MultiFunctionButton(props: IProps) {
7 | const { icon, onClick, color = 'primary' } = props;
8 | const colorFont = `${styles['variable-button']}--${color as string}`;
9 | return (
10 |
17 | );
18 | }
19 |
20 | export default MultiFunctionButton;
21 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/multi-function-button/types/IProps.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface IProps {
4 | children?: React.ReactNode;
5 | icon?: string;
6 | onClick?: () => void;
7 | color?: 'primary' | 'secondary';
8 | }
9 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/navbar/Navbar.tsx:
--------------------------------------------------------------------------------
1 | import './styles.scss';
2 | import type { IProps } from './types/IProps';
3 | import { Icon } from '../../../utils/svg-icons/icons';
4 |
5 | function Button(props: IProps) {
6 | const { children, icon } = props;
7 | return (
8 |
9 |
13 |
14 | );
15 | }
16 | export default Button;
17 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/navbar/types/IProps.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface IProps {
4 | children: React.ReactNode;
5 | icon?: string;
6 | }
7 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/ol-bullet/OLBullet.tsx:
--------------------------------------------------------------------------------
1 | import styles from './OLBullet.module.scss';
2 | import type { IProps } from './types/IProps';
3 |
4 | function OLBullet(props: IProps) {
5 | const { shape = 'square', size = 'md', active = false } = props;
6 |
7 | const bulletClass = `
8 | ${styles['ol-bullet']}
9 | ${styles[`ol-bullet--${shape}`]}
10 | ${styles[`ol-bullet--${size}`]}
11 | ${active ? styles['ol-bullet--active'] : ''}
12 | `.trim();
13 |
14 | return ;
15 | }
16 |
17 | export default OLBullet;
18 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/ol-bullet/types/IProps.ts:
--------------------------------------------------------------------------------
1 | export interface IProps {
2 | shape?: 'square' | 'rounded' | 'circle';
3 | size?: 'sm' | 'md' | 'lg';
4 | active?: boolean;
5 | }
6 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/ol-item/OLItem.tsx:
--------------------------------------------------------------------------------
1 | import styles from './OLItem.module.scss';
2 | import type { OLItemProps } from './types/IProps';
3 |
4 | function OLItem({ value, shape = 'square', size = 'md', active = false }: OLItemProps) {
5 | const olItemClass = `
6 | ${styles['ol-item']}
7 | ${styles[`ol-item--${shape}`]}
8 | ${styles[`ol-item--${size}`]}
9 | ${active ? styles['ol-item--active'] : ''}
10 | `.trim();
11 |
12 | return (
13 |
14 | {value}
15 |
16 | );
17 | }
18 |
19 | export default OLItem;
20 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/ol-item/types/IProps.ts:
--------------------------------------------------------------------------------
1 | export interface OLItemProps {
2 | value: number | string;
3 | shape?: 'square' | 'rounded' | 'circle';
4 | size?: 'sm' | 'md' | 'lg';
5 | active?: boolean;
6 | }
7 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/phone-input/types/IProps.ts:
--------------------------------------------------------------------------------
1 | export interface IProps {
2 | value: string;
3 | onChange: (value: string) => void;
4 | placeholder?: string;
5 | label?: string;
6 | variant?: 'default' | 'focus' | 'error' | 'disabled';
7 | size?: 'small' | 'medium' | 'large';
8 | borderRadius?: 'none' | 'small' | 'full';
9 | showCloseIcon?: boolean;
10 | onCloseClick?: () => void;
11 | onCopyClick?: () => void;
12 | showHintText?: boolean;
13 | hintText?: string;
14 | className?: string;
15 |
16 | // Nuevo: Código de país
17 | countryCode?: string; // Ej: "+591"
18 | onCountryChange?: (code: string) => void;
19 | }
20 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/phone-input/types/countryCodes.ts:
--------------------------------------------------------------------------------
1 | export const countryCodes = [
2 | { code: '+1', name: 'Estados Unidos' },
3 | { code: '+54', name: 'Argentina' },
4 | { code: '+55', name: 'Brasil' },
5 | { code: '+591', name: 'Bolivia' },
6 | { code: '+34', name: 'España' },
7 | ];
8 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/points-divider/PointsDivider.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import styles from './PointsDivider.module.scss';
3 | import type { DividerProps } from './types/IProps';
4 |
5 | function PointsDivider(props: DividerProps) {
6 | const { color = 'primary', size = 'small', variant = 'solid' } = props;
7 |
8 | return (
9 |
14 | {variant === 'points' && (
15 | <>
16 |
17 |
18 |
19 | >
20 | )}
21 |
22 | );
23 | }
24 |
25 | export default PointsDivider;
26 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/points-divider/types/IProps.ts:
--------------------------------------------------------------------------------
1 | export interface DividerProps {
2 | color?: 'primary' | 'secondary' | 'tertiary';
3 | size?: 'small' | 'medium' | 'large';
4 | variant?: 'solid-line' | 'segmented-line' | 'points';
5 | }
6 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/primary-buttons/PrimaryButtons.tsx:
--------------------------------------------------------------------------------
1 | import styles from './PrimaryButtons.module.scss';
2 | import type { IProps } from './types/IProps';
3 |
4 | function PrimaryButtons(props: IProps) {
5 | const { children, variant, onClick } = props;
6 | const buttonClass = `${styles['buttons-primary__button']} ${
7 | styles[`buttons-primary__button--${variant}`]
8 | }`;
9 | const labelClass = styles['buttons-primary__label'];
10 | return (
11 |
12 |
15 |
16 | );
17 | }
18 | export default PrimaryButtons;
19 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/primary-buttons/types/IProps.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface IProps {
4 | children: React.ReactNode;
5 | variant: 'primary' | 'secondary' | 'tertiary';
6 | onClick?: () => void;
7 | }
8 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/publish-button/PublishButton.tsx:
--------------------------------------------------------------------------------
1 | import styles from './PublishButton.module.scss';
2 | import type { IProps } from './types/IProps';
3 |
4 | function PublishButton(props: IProps) {
5 | const { children, variant, onClick } = props;
6 | return (
7 |
8 |
16 |
17 | );
18 | }
19 | export default PublishButton;
20 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/publish-button/types/IProps.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface IProps {
4 | children: React.ReactNode;
5 | variant: 'primary' | 'secondary' | 'tertiary' | 'warning' | 'danger';
6 | onClick?: () => void;
7 | }
8 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/reference-information/Reference.test.jsx:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import ReferenceAPA from './Reference.tsx';
3 |
4 | describe('Testing ReferenceAPA React Component', () => {
5 | test('should render with correct reference', () => {
6 | const referenceText =
7 | '1 A. Gessain, E. Nakoune, Y. Yazdanpanah, Monkeypox. N. Engl. J. Med. 387, 1783–1793 (2022)';
8 | render();
9 | const referenceElement = screen.getByText(referenceText);
10 | expect(referenceElement).toBeInTheDocument();
11 | });
12 | });
13 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/reference-information/_mocked/references.json:
--------------------------------------------------------------------------------
1 | {
2 | "pnasUrl": "https://www.pnas.org/doi/10.1073/pnas.2301662120#body-ref-r1",
3 | "nejmUrl": "https://www.nejm.org/doi/10.1056/NEJMra2208860",
4 | "pubmedUrl": "https://pubmed.ncbi.nlm.nih.gov/36286263/",
5 | "googleScholarUrl": "https://scholar.google.com/scholar_lookup?title=Monkeypox&author=A.+Gessain"
6 | }
7 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/reference-information/types/IProps.ts:
--------------------------------------------------------------------------------
1 | export interface IProps {
2 | text?: string;
3 | color?: 'primary' | 'secondary' | 'tertiary';
4 | }
5 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/shadow-card/ShadowCard.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from '@storybook/react';
2 | import React from 'react';
3 | import ShadowsDemo from '../../../../Shadows/ShadowsDemo';
4 |
5 | const meta: Meta = {
6 | title: 'Design System/Shadows',
7 | component: ShadowsDemo,
8 | };
9 |
10 | export default meta;
11 | type Story = StoryObj;
12 |
13 | export const AllShadows: Story = {
14 | render: () => ,
15 | };
16 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/social-media-button/Button.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { StoryObj, Meta } from '@storybook/react';
2 | import Button from './Button';
3 | import Facebook from '../../../../assets/icons/facebook.svg?raw';
4 | import Google from '../../../../assets/icons/google.svg?raw';
5 |
6 | const meta = {
7 | title: 'ui/components/atoms/social-media-button',
8 | component: Button,
9 | argTypes: {
10 | onClick: {
11 | action: 'click',
12 | },
13 | },
14 | } as Meta;
15 |
16 | export default meta;
17 |
18 | type Story = StoryObj;
19 |
20 | export const Primary: Story = {
21 | args: {
22 | children: 'Google',
23 | icon: Google,
24 | },
25 | };
26 |
27 | export const Secondary: Story = {
28 | args: {
29 | children: 'Facebook',
30 | icon: Facebook,
31 | },
32 | };
33 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/social-media-button/Button.test.jsx:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import Facebook from '../../../../assets/icons/facebook.svg?raw';
3 | import Google from '../../../../assets/icons/google.svg?raw';
4 | import Button from './Button.tsx';
5 |
6 | describe('Testing Button React Component', () => {
7 | test('should be rendere Google', () => {
8 | render();
9 | const buttonElement = screen.getByText(/Google/i);
10 | expect(buttonElement).toBeInTheDocument();
11 | });
12 |
13 | test('should be rendere Facebook', () => {
14 | render();
15 | const buttonElement = screen.getByText(/Facebook/i);
16 | expect(buttonElement).toBeInTheDocument();
17 | });
18 | });
19 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/social-media-button/Button.tsx:
--------------------------------------------------------------------------------
1 | import styles from './Button.module.scss';
2 | import { Icon } from '../../../utils/svg-icons/icons';
3 | import type { IProps } from './types/IProps';
4 |
5 | function SMButton(props: IProps) {
6 | const { children, icon, color } = props;
7 | const colorFont = styles[`button--${color as string}`];
8 | return (
9 |
15 | );
16 | }
17 | export default SMButton;
18 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/social-media-button/types/IProps.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface IProps {
4 | children: React.ReactNode;
5 | variant?: string;
6 | icon?: string;
7 | color?: 'primary' | 'secondary';
8 | }
9 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/start-button/StartButton.tsx:
--------------------------------------------------------------------------------
1 | import './StartButton.scss';
2 | import { Icon } from '../../../utils/svg-icons/icons';
3 | import type { IProps } from './types/IProps';
4 |
5 | function StartButton(props: IProps) {
6 | const { children, icon, variant = 'primary' } = props;
7 |
8 | return (
9 |
13 | );
14 | }
15 |
16 | export default StartButton;
17 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/start-button/types/IProps.ts:
--------------------------------------------------------------------------------
1 | export interface IProps {
2 | children?: string;
3 | variant?: 'primary' | 'secondary' | 'tertiary';
4 | icon?: string | null;
5 | onClick?: () => void;
6 | }
7 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/text-field/Icon.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import SearchIcon from '../../../../assets/icons/search.svg?react';
3 | import ErrorIcon from '../../../../assets/icons/error.svg?react';
4 |
5 | const icons: Record>> = {
6 | search: SearchIcon,
7 | error: ErrorIcon,
8 | };
9 |
10 | interface IconProps {
11 | name: keyof typeof icons;
12 | className?: string;
13 | }
14 |
15 | function Icon({ name, className }: IconProps): JSX.Element {
16 | const SvgIcon = icons[name];
17 | return ;
18 | }
19 |
20 | export default Icon;
21 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/text-field/types/IProps.ts:
--------------------------------------------------------------------------------
1 | import type { ReactNode } from 'react';
2 |
3 | export interface ITextFieldProps {
4 | label?: string;
5 | value: string;
6 | onChange: (val: string) => void;
7 | placeholder?: string;
8 | error?: boolean;
9 | helperText?: string;
10 | disabled?: boolean;
11 | leftIcon?: ReactNode;
12 | rightIcon?: ReactNode;
13 | size?: 'small' | 'medium' | 'large';
14 | className?: string;
15 | type?: 'text' | 'email' | 'password' | 'number';
16 | name?: string;
17 | required?: boolean;
18 | autoComplete?: string;
19 | }
20 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/thumbnail/Thumbnail.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import styles from './Thumbnail.module.scss';
3 | import type { IProps } from './types/IProps';
4 |
5 | function Thumbnail(props: IProps) {
6 | const { pathImage, alt } = props;
7 |
8 | return (
9 |
10 |

11 |
12 | {' '}
13 | {/* Contenido del overlay */}
14 |
15 |
16 | );
17 | }
18 |
19 | export default Thumbnail;
20 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/thumbnail/__mock__/imgs/Rectangle27.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ditmar/OpenScience/f659c7b51d989fcf64d754bfa76615a642856447/src/ui/components/atoms/thumbnail/__mock__/imgs/Rectangle27.png
--------------------------------------------------------------------------------
/src/ui/components/atoms/thumbnail/__mock__/imgs/Rectangle28.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ditmar/OpenScience/f659c7b51d989fcf64d754bfa76615a642856447/src/ui/components/atoms/thumbnail/__mock__/imgs/Rectangle28.png
--------------------------------------------------------------------------------
/src/ui/components/atoms/thumbnail/__mock__/imgs/Rectangle29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ditmar/OpenScience/f659c7b51d989fcf64d754bfa76615a642856447/src/ui/components/atoms/thumbnail/__mock__/imgs/Rectangle29.png
--------------------------------------------------------------------------------
/src/ui/components/atoms/thumbnail/__mock__/imgs/Rectangle30.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ditmar/OpenScience/f659c7b51d989fcf64d754bfa76615a642856447/src/ui/components/atoms/thumbnail/__mock__/imgs/Rectangle30.png
--------------------------------------------------------------------------------
/src/ui/components/atoms/thumbnail/__mock__/imgs/Rectangle31.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ditmar/OpenScience/f659c7b51d989fcf64d754bfa76615a642856447/src/ui/components/atoms/thumbnail/__mock__/imgs/Rectangle31.png
--------------------------------------------------------------------------------
/src/ui/components/atoms/thumbnail/__mock__/imgs/Rectangle32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ditmar/OpenScience/f659c7b51d989fcf64d754bfa76615a642856447/src/ui/components/atoms/thumbnail/__mock__/imgs/Rectangle32.png
--------------------------------------------------------------------------------
/src/ui/components/atoms/thumbnail/types/IProps.ts:
--------------------------------------------------------------------------------
1 | export interface IProps {
2 | pathImage: string;
3 | alt?: string;
4 | }
5 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/typography-paragraph/types/IProps.ts:
--------------------------------------------------------------------------------
1 | export interface IProps {
2 | text?: string;
3 | size?: 'extra-small' | 'small' | 'medium-size' | 'large' | 'extra-large';
4 | weight?: 'light' | 'regular' | 'medium' | 'semi-bold' | 'bold';
5 | color?: 'dark' | 'white';
6 | textDecoration?: 'none-line' | 'underline' | 'line-through';
7 | italic?: boolean;
8 | }
9 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/url-input/types/IProps.ts:
--------------------------------------------------------------------------------
1 | export interface IProps {
2 | value: string;
3 | onChange: (value: string) => void;
4 | placeholder?: string;
5 | label?: string;
6 | variant?: 'default' | 'focus' | 'error' | 'disabled';
7 | size?: 'small' | 'medium' | 'large';
8 | borderRadius?: 'none' | 'small' | 'full';
9 | showCloseIcon?: boolean;
10 | onCloseClick?: () => void;
11 | onCopyClick?: () => void;
12 | showHintText?: boolean;
13 | hintText?: string;
14 | className?: string;
15 | }
16 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/variable-button/VariableButton.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import styles from './variableButton.module.scss';
3 | import type { IProps } from './types/IProps';
4 | import { Icon } from '../../../utils/svg-icons/icons';
5 |
6 | function VariableButton(props: IProps) {
7 | const { icon, onClick } = props;
8 | return (
9 |
12 | );
13 | }
14 |
15 | export default VariableButton;
16 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/variable-button/types/IProps.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface IProps {
4 | children?: React.ReactNode;
5 | icon?: string;
6 | onClick?: () => void;
7 | }
8 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/variable-button/variableButton.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { StoryObj, Meta } from '@storybook/react';
2 | import VariableButton from './VariableButton';
3 | import PdfIcon from '../../../../assets/icons/pdf.svg?raw';
4 | import LinkIcon from '../../../../assets/icons/share.svg?raw';
5 |
6 | const meta = {
7 | title: 'ui/components/atoms/variable-button',
8 | component: VariableButton,
9 | argTypes: {
10 | onClick: {
11 | action: 'click',
12 | },
13 | },
14 | } as Meta;
15 |
16 | export default meta;
17 |
18 | type Story = StoryObj;
19 |
20 | export const PdfButton: Story = {
21 | args: {
22 | children: 'PDF',
23 | icon: PdfIcon,
24 | },
25 | };
26 |
27 | export const LinkButton: Story = {
28 | args: {
29 | children: 'SHARE',
30 | icon: LinkIcon,
31 | },
32 | };
33 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/variable-button/variableButton.test.tsx:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import PdfIcon from '../../../../assets/icons/pdf.svg?raw';
3 | import LinkIcon from '../../../../assets/icons/share.svg?raw';
4 | import VariableButton from './VariableButton';
5 |
6 | describe('VariableButton Component', () => {
7 | test('renders PDF button', () => {
8 | render();
9 | const buttonElement = screen.getByTestId('button-icon');
10 | expect(buttonElement).toBeInTheDocument();
11 | });
12 |
13 | test('renders Link button', () => {
14 | render();
15 | const buttonElement = screen.getByTestId('button-icon');
16 | expect(buttonElement).toBeInTheDocument();
17 | });
18 | });
19 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/year/Year.module.scss:
--------------------------------------------------------------------------------
1 | @import '../../../../globals/variables';
2 | @import '../../../../globals/mixins';
3 | @import '../../../../globals/fonts';
4 |
5 | .year {
6 | background-color: transparent;
7 | border: none;
8 | border-radius: 0.2rem;
9 | color: $ads-color-main;
10 | height: 1.2rem;
11 | text-transform: uppercase;
12 | width: 2.5rem;
13 |
14 | .year-label {
15 | color: $ads-color-main;
16 | font-family: Lato, Arial, Helvetica, sans-serif;
17 | font-size: 0.75rem;
18 | font-weight: bold;
19 | }
20 |
21 | @include respond-to('small') {
22 | height: 2rem;
23 | text-transform: capitalize;
24 | width: 4rem;
25 |
26 | .year-label {
27 | font-size: 1.15rem;
28 | }
29 | }
30 |
31 | &:hover {
32 | background-color: $ads-background-color-black;
33 | cursor: pointer;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/year/Year.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { StoryObj, Meta } from '@storybook/react';
2 | import ButtonYear from './Year';
3 |
4 | const meta = {
5 | title: 'ui/components/atoms/year',
6 | component: ButtonYear,
7 | argTypes: {
8 | onClick: {
9 | action: 'click',
10 | },
11 | variant: {
12 | control: 'select',
13 | },
14 | },
15 | } as Meta;
16 |
17 | export default meta;
18 |
19 | type Story = StoryObj;
20 |
21 | export const Primary: Story = {
22 | args: {
23 | children: '2023',
24 | },
25 | };
26 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/year/Year.test.tsx:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import Year from './Year';
3 |
4 | describe('Testing ButtonWithVariants React Component', () => {
5 | test('should render test 1', () => {
6 | render(2023);
7 | const buttonElement = screen.getByText('2023');
8 | expect(buttonElement).toBeInTheDocument();
9 | });
10 | });
11 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/year/Year.tsx:
--------------------------------------------------------------------------------
1 | import styles from './Year.module.scss';
2 | import type { IProps } from './types/IProps';
3 |
4 | function Year({ children, onClick }: IProps) {
5 | const variantClass = styles.year;
6 | return (
7 |
10 | );
11 | }
12 |
13 | export default Year;
14 |
--------------------------------------------------------------------------------
/src/ui/components/atoms/year/types/IProps.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface IProps {
4 | children: React.ReactNode;
5 | onClick?: () => void;
6 | }
7 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/InfoTooltip/types/IProps.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface InfoTooltipProps {
4 | content: string;
5 | position?: 'top' | 'bottom' | 'left' | 'right';
6 | size?: 'small' | 'medium' | 'large';
7 | className?: string;
8 | icon?: React.ReactNode;
9 | delay?: number;
10 | children?: React.ReactNode;
11 | }
12 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/LoginPage/LoginPage.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { StoryObj, Meta } from '@storybook/react';
2 | import logo from '../../../../assets/icons/logo.svg?raw';
3 | import NetworkLogin from './LoginPage';
4 |
5 | const meta: Meta = {
6 | title: 'ui/components/molecules/login-page',
7 | component: NetworkLogin,
8 | argTypes: {},
9 | };
10 | export default meta;
11 |
12 | type Story = StoryObj;
13 |
14 | export const Primary: Story = {
15 | args: {
16 | icon: logo,
17 | color: 'primary',
18 | },
19 | };
20 |
21 | export const Secodary: Story = {
22 | args: {
23 | icon: logo,
24 | color: 'secondary',
25 | },
26 | };
27 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/LoginPage/LoginPage.test.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from '@testing-library/react';
3 | import NetworkLogin from './LoginPage';
4 |
5 | describe('NetworkLogin Component', () => {
6 | it('should render NetworkLogin component', () => {
7 | const { getByTestId } = render();
8 | const pageElement = getByTestId('login-page');
9 | expect(pageElement).toBeInTheDocument();
10 | });
11 | });
12 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/LoginPage/LoginPage.tsx:
--------------------------------------------------------------------------------
1 | import type { IProps } from './types/IProps';
2 | import LogoFooter from '../../atoms/logo-footer/LogoFooter';
3 | import './LoginPage.scss';
4 | import logo from '../../../../assets/icons/logo.svg?raw';
5 | import vector from '../../../../assets/icons/vector.svg?raw';
6 | import StartButton from '../../atoms/start-button/StartButton';
7 |
8 | function LoginPage({ color = 'primary' }: IProps) {
9 | const getColorClassName = () => {
10 | return color === 'primary' ? 'page--primary' : 'page--secondary';
11 | };
12 |
13 | return (
14 |
15 |
16 |
17 | INICIAR
18 |
19 |
20 | );
21 | }
22 |
23 | export default LoginPage;
24 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/LoginPage/types/IProps.ts:
--------------------------------------------------------------------------------
1 | export interface IProps {
2 | icon?: string | null;
3 | color?: 'primary' | 'secondary';
4 | onClick?: () => void;
5 | }
6 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/article-publish/ArticlePublish.module.scss:
--------------------------------------------------------------------------------
1 | @import '../../../../globals/variables';
2 | @import '../../../../globals/mixins';
3 |
4 | .article-publish {
5 | align-items: center;
6 | display: flex;
7 | flex-direction: column;
8 | justify-content: center;
9 | text-align: center;
10 | }
11 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/article-publish/ArticlePublish.tsx:
--------------------------------------------------------------------------------
1 | import type { IProps } from './types/IProps';
2 | import styles from './ArticlePublish.module.scss';
3 |
4 | function ArticlePublish(props: IProps) {
5 | const { children } = props;
6 |
7 | return {children}
;
8 | }
9 |
10 | export default ArticlePublish;
11 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/article-publish/types/IProps.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface IProps {
4 | children: React.ReactNode;
5 | }
6 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/article/Article.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from '@storybook/react';
2 | import Article from './Article';
3 |
4 | const meta: Meta = {
5 | title: 'ui/components/molecules/articles-page',
6 | component: Article,
7 | parameters: {
8 | layout: 'fullscreen',
9 | },
10 | };
11 |
12 | export default meta;
13 |
14 | type Story = StoryObj;
15 |
16 | export const Default: Story = {};
17 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/banner-articles/BannerArticles.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { StoryObj, Meta } from '@storybook/react';
2 | import BannerVolumes from './BannerArticles';
3 | import Rectangle12 from '../../atoms/hero-banner/__mock__/imgs/Rectangle12.png';
4 | import LogoSvg from '../../../../assets/icons/logo.svg';
5 |
6 | const meta: Meta = {
7 | title: 'ui/components/molecules/banner-articles',
8 | component: BannerVolumes,
9 | };
10 |
11 | export default meta;
12 |
13 | type Story = StoryObj;
14 |
15 | export const Default: Story = {
16 | args: {
17 | textSearch: 'Buscar',
18 | backgroundImage: String(Rectangle12),
19 | logo: String(LogoSvg),
20 | },
21 | };
22 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/banner-articles/types/IProps.ts:
--------------------------------------------------------------------------------
1 | export interface IProps {
2 | textSearch: string;
3 | backgroundImage: string;
4 | logo: string;
5 | }
6 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/banner-volumes/BannerVolumes.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { StoryObj, Meta } from '@storybook/react';
2 | import BannerVolumes from './BannerVolumes';
3 | import dataMock from './__mock__/datamock.json';
4 | import Rectangle12 from '../../atoms/hero-banner/__mock__/imgs/Rectangle12.png';
5 | import LogoSvg from '../../../../assets/icons/logo.svg';
6 |
7 | const meta: Meta = {
8 | title: 'ui/components/molecules/banner-volumes',
9 | component: BannerVolumes,
10 | };
11 |
12 | export default meta;
13 |
14 | type Story = StoryObj;
15 |
16 | export const Default: Story = {
17 | args: {
18 | data: dataMock.data,
19 | textSearch: 'Buscar',
20 | yearText: 'año',
21 | backgroundImage: String(Rectangle12),
22 | logo: String(LogoSvg),
23 | },
24 | };
25 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/banner-volumes/BannerVolumes.test.tsx:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import { describe, it, expect } from 'vitest';
3 | import BannerVolumes from './BannerVolumes';
4 | import dataMock from './__mock__/datamock.json';
5 | import Rectangle12 from '../../atoms/hero-banner/__mock__/imgs/Rectangle12.png';
6 | import LogoSvg from '../../../../assets/icons/logo.svg';
7 |
8 | describe('YearList', () => {
9 | it('should render the correct text button', () => {
10 | render(
11 | ,
18 | );
19 |
20 | expect(screen.getByText(/año/i)).toBeInTheDocument();
21 | });
22 | });
23 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/banner-volumes/types/IProps.ts:
--------------------------------------------------------------------------------
1 | export interface IAttributes {
2 | Year: string;
3 | Volumes: string;
4 | }
5 |
6 | export interface IData {
7 | id: number;
8 | attributes: IAttributes;
9 | }
10 | export interface IProps {
11 | data: IData[];
12 | yearText: string;
13 | textSearch: string;
14 | backgroundImage: string;
15 | logo: string;
16 | }
17 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/buttons-pdf-share/ButtonsPdfShare.scss:
--------------------------------------------------------------------------------
1 | .button-pdf-share {
2 | align-items: center;
3 | display: flex;
4 | gap: 1.5rem;
5 | margin-top: 13rem;
6 | }
7 |
8 | .share-container {
9 | position: relative;
10 | }
11 |
12 | .share-button {
13 | bottom: 100%;
14 | display: flex;
15 | flex-direction: column;
16 | gap: 0;
17 | left: 0;
18 | position: absolute;
19 | }
20 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/buttons-pdf-share/ButtonsPdfShare.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { StoryObj, Meta } from '@storybook/react';
2 | import ButtonsPdfShare from './ButtonsPdfShare';
3 |
4 | const meta: Meta = {
5 | title: 'ui/components/molecules/PdfShareButton',
6 | component: ButtonsPdfShare,
7 | argTypes: {
8 | onClick: { action: 'clicked' },
9 | },
10 | };
11 | export default meta;
12 |
13 | type Story = StoryObj;
14 |
15 | export const Primary: Story = {
16 | args: {},
17 | };
18 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/buttons-pdf-share/ButtonsPdfShare.test.tsx:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import PdfShareButton from './ButtonsPdfShare';
3 |
4 | describe('PdfShareButton Component', () => {
5 | it('should render PdfShareButton component', () => {
6 | render();
7 | const shareButton = screen.getByTestId('pdf-share-button');
8 | expect(shareButton).toBeInTheDocument();
9 | });
10 | test('items should not be visible initially', () => {
11 | render();
12 | expect(screen.queryByText('WhatsappIcon')).not.toBeInTheDocument();
13 | expect(screen.queryByText('FacebookIcon')).not.toBeInTheDocument();
14 | expect(screen.queryByText('TelegramIcon')).not.toBeInTheDocument();
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/buttons-pdf-share/types/IProps.ts:
--------------------------------------------------------------------------------
1 | export interface IProps {
2 | icon?: string;
3 | onClick?: () => void;
4 | }
5 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/featured-article/FeaturedArticle.scss:
--------------------------------------------------------------------------------
1 | @import '../../../../globals/variables';
2 | @import '../../../../globals/mixins';
3 |
4 | .featured-article {
5 | position: relative;
6 | }
7 |
8 | .divider {
9 | align-items: center;
10 | display: flex;
11 | justify-content: space-between;
12 | margin: 0;
13 | width: 100%;
14 |
15 | .buttons {
16 | display: flex;
17 | gap: 10px;
18 | margin-left: auto;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/featured-article/FeaturedArticle.tsx:
--------------------------------------------------------------------------------
1 | import type { IProps } from './types/IProps.js';
2 | import './FeaturedArticle.scss';
3 |
4 | function FeaturedArticle(props: IProps) {
5 | const { children } = props;
6 | return {children}
;
7 | }
8 |
9 | export default FeaturedArticle;
10 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/featured-article/types/IProps.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface IProps {
4 | children: React.ReactNode;
5 | onClick?: () => void;
6 | text?: string;
7 | icon?: string;
8 | size?: 'small' | 'medium' | 'large';
9 | variant: 'default' | 'primary' | 'secondary ' | 'solid-line' | 'points' | 'main';
10 | color?: 'primary' | 'secondary' | 'tertiary';
11 | ColorVariant?: 'main' | 'primary' | 'secondary';
12 | article: string;
13 | date: Date;
14 | }
15 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/footer-variables/FooterVariables.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { StoryObj, Meta } from '@storybook/react';
2 | import FooterVariables from './FooterVariables';
3 | import '../../../../globals/_variables.scss';
4 |
5 | const meta: Meta = {
6 | title: 'ui/components/molecules/footer-variables',
7 | component: FooterVariables,
8 | };
9 |
10 | export default meta;
11 |
12 | type Story = StoryObj;
13 |
14 | export const Default: Story = {};
15 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/header-banner/HeaderBanner.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { StoryObj, Meta } from '@storybook/react';
2 | import BannerVolumes from './HeaderBanner';
3 | import Rectangle12 from '../../atoms/hero-banner/__mock__/imgs/Rectangle12.png';
4 | import LogoSvg from '../../../../assets/icons/logo.svg';
5 |
6 | const meta: Meta = {
7 | title: 'ui/components/molecules/header-banner',
8 | component: BannerVolumes,
9 | };
10 |
11 | export default meta;
12 |
13 | type Story = StoryObj;
14 |
15 | export const Default: Story = {
16 | args: {
17 | textSearch: 'Buscar',
18 | backgroundImage: String(Rectangle12),
19 | logo: String(LogoSvg),
20 | },
21 | };
22 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/header-banner/types/IProps.ts:
--------------------------------------------------------------------------------
1 | export interface IAttributes {
2 | Year: string;
3 | Volumes: string;
4 | }
5 |
6 | export interface IData {
7 | id: number;
8 | attributes: IAttributes;
9 | }
10 | export interface IProps {
11 | textSearch: string;
12 | backgroundImage: string;
13 | logo: string;
14 | }
15 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/location-variable/Location.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { StoryObj, Meta } from '@storybook/react';
2 | import Facebook from '../../../../assets/icons/facelocation.svg?raw';
3 | import location from '../../../../assets/icons/location.svg?raw';
4 | import Location from './Location';
5 |
6 | const meta = {
7 | title: 'ui/components/molecules/location-variable',
8 | component: Location,
9 | argTypes: {
10 | variant: {
11 | control: { type: 'select' },
12 | options: ['solid', 'dotted', 'dashed'],
13 | },
14 | },
15 | } as Meta;
16 |
17 | export default meta;
18 |
19 | type Story = StoryObj;
20 |
21 | export const Primary: Story = {
22 | args: {
23 | icon: location,
24 | children: 'UBICACIÓN',
25 | variant: 'solid',
26 | icon1: Facebook,
27 | children1: 'SÍGUENOS EN',
28 | },
29 | };
30 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/location-variable/Location.tsx:
--------------------------------------------------------------------------------
1 | import './styles.scss';
2 | import type { IProps } from './types/IProps';
3 | import { Icon } from '../../../utils/svg-icons/icons';
4 |
5 | function Location(props: IProps) {
6 | const { variant, children, icon, icon1, children1 } = props;
7 | return (
8 |
9 | {children}
10 |
13 |
14 | {children1}
15 |
18 |
19 | );
20 | }
21 | export default Location;
22 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/location-variable/types/IProps.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface IProps {
4 | icon?: string;
5 | icon1?: string;
6 | children: React.ReactNode;
7 | children1: React.ReactNode;
8 | variant: 'solid' | 'dotted' | 'dashed';
9 | }
10 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/login-register-buttons/LoginRegisterButton.module.scss:
--------------------------------------------------------------------------------
1 | @import '../../../../globals/variables';
2 | @import '../../../../globals/mixins';
3 |
4 | .auth-buttons {
5 | display: flex;
6 | gap: 1rem;
7 | }
8 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/login-register-buttons/LoginRegisterButton.test.tsx:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import LoginRegisterButtons from './LoginRegisterButtons';
3 | import PrimaryButtons from '../../atoms/primary-buttons/PrimaryButtons';
4 |
5 | describe('LoginRegisterButtons Component', () => {
6 | test('should render both buttons', () => {
7 | render(
8 |
9 | Iniciar sesión
10 | Registrarse
11 | ,
12 | );
13 | const loginButton = screen.getByText(/Iniciar sesión/i);
14 | const registerButton = screen.getByText(/Registrarse/i);
15 |
16 | expect(loginButton).toBeInTheDocument();
17 | expect(registerButton).toBeInTheDocument();
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/login-register-buttons/LoginRegisterButtons.tsx:
--------------------------------------------------------------------------------
1 | import type { IProps } from './types/IProps';
2 | import styles from './LoginRegisterButton.module.scss';
3 |
4 | function LoginRegisterButtons(props: IProps) {
5 | const { children } = props;
6 | return {children}
;
7 | }
8 |
9 | export default LoginRegisterButtons;
10 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/login-register-buttons/types/IProps.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface IProps {
4 | children: React.ReactNode;
5 | onClick?: () => void;
6 | }
7 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/magnifying-glass/MagnifyingGlass.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { StoryObj, Meta } from '@storybook/react';
2 | import '../../../../globals/_variables.scss';
3 | import magnifyingglass from '../../../../assets/icons/magnifyingglass.svg?raw';
4 | import MagnifyingGlass from './MagnifyingGlass';
5 |
6 | const meta = {
7 | title: 'ui/components/molecules/magnifying-glass',
8 | component: MagnifyingGlass,
9 | argTypes: {
10 | onClick: {
11 | action: 'click',
12 | },
13 | variant: {
14 | control: { type: 'select' },
15 | options: ['solid', 'dotted', 'dashed'],
16 | },
17 | },
18 | } as Meta;
19 |
20 | export default meta;
21 |
22 | type Story = StoryObj;
23 |
24 | export const MagnifyinGlass: Story = {
25 | args: {
26 | icon: magnifyingglass,
27 | variant: 'solid',
28 | children: 'BUSCAR',
29 | },
30 | };
31 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/magnifying-glass/MagnifyingGlass.test.tsx:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import magnifyingglass from '../../../../assets/icons/magnifyingglass.svg?raw';
3 | import MagnifyingGlass from './MagnifyingGlass';
4 |
5 | describe('Testing MagnifyingGlass React Component', () => {
6 | test('should be rendere MagnifyingGlass icon', () => {
7 | render();
8 | const buttonElement = screen.getByTestId('button__glass');
9 | expect(buttonElement).toBeInTheDocument();
10 | });
11 | });
12 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/magnifying-glass/MagnifyingGlass.tsx:
--------------------------------------------------------------------------------
1 | import './style.scss';
2 | import type { IProps } from './types/IProps';
3 | import { Icon } from '../../../utils/svg-icons/icons';
4 |
5 | function MagnifyingGlass(props: IProps) {
6 | const { icon, onClick } = props;
7 |
8 | return (
9 |
10 |
13 |
14 | );
15 | }
16 | export default MagnifyingGlass;
17 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/magnifying-glass/style.scss:
--------------------------------------------------------------------------------
1 | @import '../../../../globals/variables';
2 | @import '../../../../globals/mixins';
3 | @import '../../../../globals/fonts';
4 |
5 | .glass {
6 | align-items: center;
7 | display: flex;
8 | flex-direction: column;
9 | justify-content: center;
10 | }
11 |
12 | .disguise {
13 | background-color: transparent;
14 | border: none;
15 | margin-left: 94%;
16 | margin-top: -0.4rem;
17 | }
18 |
19 | .button__icons--glass svg {
20 | height: 1.125rem;
21 | width: 1.125rem;
22 |
23 | @include respond-to('medium') {
24 | height: 2rem;
25 | width: 2rem;
26 | }
27 |
28 | @include respond-to('extra-large') {
29 | height: 2rem;
30 | width: 2rem;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/magnifying-glass/types/IProps.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface IProps {
4 | children?: React.ReactNode;
5 | icon: string;
6 | variant: 'solid' | 'dotted' | 'dashed';
7 | onClick?: () => void;
8 | }
9 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/network-login/network-login.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { StoryObj, Meta } from '@storybook/react';
2 | import logo from '../../../../assets/icons/logo.svg?raw';
3 | import NetworkLogin from './network-login';
4 |
5 | const meta: Meta = {
6 | title: 'ui/components/molecules/network-login',
7 | component: NetworkLogin,
8 | argTypes: {},
9 | };
10 | export default meta;
11 |
12 | type Story = StoryObj;
13 |
14 | export const Primary: Story = {
15 | args: {
16 | icon: logo,
17 | color: 'primary',
18 | },
19 | };
20 |
21 | export const Secodary: Story = {
22 | args: {
23 | icon: logo,
24 | color: 'secondary',
25 | },
26 | };
27 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/network-login/network-login.test.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from '@testing-library/react';
3 | import NetworkLogin from './network-login';
4 |
5 | describe('NetworkLogin Component', () => {
6 | it('should render NetworkLogin component', () => {
7 | const { getByTestId } = render();
8 | const panelElement = getByTestId('net-login');
9 | expect(panelElement).toBeInTheDocument();
10 | });
11 | });
12 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/network-login/types/IProps.ts:
--------------------------------------------------------------------------------
1 | export interface IProps {
2 | icon?: string | null;
3 | color?: 'primary' | 'secondary';
4 | onClick?: () => void;
5 | }
6 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/option-menu/OptionMenu.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from '@storybook/react';
2 | import OptionMenu from './OptionMenu';
3 |
4 | const meta: Meta = {
5 | title: 'ui/components/molecules/Option-Menu',
6 | component: OptionMenu,
7 | };
8 |
9 | export default meta;
10 |
11 | type Story = StoryObj;
12 |
13 | export const Default: Story = {};
14 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/option-menu/OptionMenu.test.tsx:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import OptionMenu from './OptionMenu';
3 |
4 | describe('OptionMenu Component', () => {
5 | test('should render ButtonBurger', () => {
6 | render();
7 | const burgerButton = screen.getByLabelText('Menu');
8 | expect(burgerButton).toBeInTheDocument();
9 | });
10 |
11 | test('menu items should not be visible initially', () => {
12 | render();
13 | expect(screen.queryByText('Pdf')).not.toBeInTheDocument();
14 | expect(screen.queryByText('Share')).not.toBeInTheDocument();
15 | expect(screen.queryByText('Media')).not.toBeInTheDocument();
16 | expect(screen.queryByText('Reference')).not.toBeInTheDocument();
17 | });
18 | });
19 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/option-menu/types/IProps.ts:
--------------------------------------------------------------------------------
1 | export interface IProps {
2 | icon?: string;
3 | onClick?: () => void;
4 | }
5 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/pdf-share-buttons/PdfShareButton.scss:
--------------------------------------------------------------------------------
1 | .pdf-share-buttons {
2 | align-items: center;
3 | display: flex;
4 | gap: 1.5rem;
5 | margin-top: 13rem;
6 | }
7 |
8 | .share {
9 | position: relative;
10 | }
11 |
12 | .share-buttons {
13 | bottom: 100%;
14 | display: flex;
15 | flex-direction: column;
16 | gap: 0;
17 | left: 0;
18 | position: absolute;
19 | }
20 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/pdf-share-buttons/PdfShareButton.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { StoryObj, Meta } from '@storybook/react';
2 | import PdfShareButton from './PdfShareButton';
3 |
4 | const meta: Meta = {
5 | title: 'ui/components/molecules/pdf-share-buttons',
6 | component: PdfShareButton,
7 | };
8 |
9 | export default meta;
10 |
11 | type Story = StoryObj;
12 |
13 | export const Default: Story = {};
14 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/pdf-share-buttons/types/IProps.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface IProps {
4 | children: React.ReactNode;
5 | }
6 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/recent-articles-image/RecentArticlesImage.tsx:
--------------------------------------------------------------------------------
1 | import type { IProps } from './types/IProps.js';
2 | import './styles.scss';
3 | import Rectangle29 from '../../atoms/thumbnail/__mock__/imgs/Rectangle29.png';
4 | import Thumbnail from '../../atoms/thumbnail/Thumbnail';
5 |
6 | console.log('Rectangle29:', Rectangle29);
7 |
8 | function RecentArticlesImage(props: IProps) {
9 | const { children } = props;
10 | return (
11 |
12 |
{children}
13 |
14 |
21 |
22 |
23 | );
24 | }
25 |
26 | export default RecentArticlesImage;
27 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/recent-articles-image/types/IProps.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface IProps {
4 | children: React.ReactNode;
5 | onClick?: () => void;
6 | text?: string;
7 | icon?: string;
8 | size?: 'small' | 'medium' | 'large';
9 | variant: 'default' | 'primary' | 'secondary ' | 'solid-line' | 'points' | 'main';
10 | color?: 'primary' | 'secondary' | 'tertiary';
11 | ColorVariant?: 'main' | 'primary' | 'secondary';
12 | article: string;
13 | date: Date;
14 | pathImage: string;
15 | }
16 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/references/References.scss:
--------------------------------------------------------------------------------
1 | @import '../../../../globals/variables';
2 | @import '../../../../globals/mixins';
3 |
4 | .references {
5 | background-color: $ads-background-desktop;
6 |
7 | a {
8 | color: $ads-text-main-hover;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/references/References.tsx:
--------------------------------------------------------------------------------
1 | import type { IProps } from './types/IProps';
2 | import './References.scss';
3 |
4 | function References(props: IProps) {
5 | const { children } = props;
6 |
7 | return {children}
;
8 | }
9 |
10 | export default References;
11 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/references/types/IProps.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface IProps {
4 | children: React.ReactNode;
5 | }
6 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/side-panel/mobile-side-pandel/MSPanel.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { StoryObj, Meta } from '@storybook/react';
2 | import MSPanel from './MSPanel';
3 |
4 | const meta: Meta = {
5 | title: 'ui/components/molecules/side-panel/Mobile-side-panel',
6 | component: MSPanel,
7 | argTypes: {},
8 | };
9 | export default meta;
10 |
11 | type Story = StoryObj;
12 |
13 | export const Primary: Story = {
14 | args: {
15 | variant: 'default',
16 | },
17 | };
18 |
19 | export const Secondary: Story = {
20 | args: {
21 | variant: 'color',
22 | },
23 | };
24 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/side-panel/mobile-side-pandel/MSPanel.test.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from '@testing-library/react';
3 | import MSPanel from './MSPanel';
4 |
5 | describe('MSPanel Component', () => {
6 | it('should render SPanel component', () => {
7 | const { getByTestId } = render();
8 | const panelElement = getByTestId('ms-panel');
9 | expect(panelElement).toBeInTheDocument();
10 | });
11 | });
12 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/side-panel/mobile-side-pandel/types/IProps.ts:
--------------------------------------------------------------------------------
1 | export interface IProps {
2 | variant?: 'default' | 'color';
3 | }
4 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/side-panel/panel/SPanel.scss:
--------------------------------------------------------------------------------
1 | @import '../../../../../globals/variables';
2 | @import '../../../../../globals/mixins';
3 |
4 | .panel {
5 | background: $ads-background-main;
6 | display: flex;
7 | flex-direction: column;
8 | height: 280px;
9 | padding: 2.2rem;
10 | width: 200px;
11 |
12 | &--secondary {
13 | position: sticky;
14 | }
15 | }
16 |
17 | .tags .tag {
18 | font-size: $ads-font-size-second;
19 | margin: 0.5rem;
20 |
21 | &--secondary {
22 | background: $ads-secondary-main;
23 | }
24 | }
25 |
26 | .tag:hover {
27 | text-decoration: underline;
28 | }
29 |
30 | .logo {
31 | align-items: center;
32 | background: transparent;
33 | display: flexbox;
34 | height: 70px;
35 | width: 155px;
36 | }
37 |
38 | .logo .logo-icon {
39 | & svg {
40 | height: 100%;
41 | width: 100%;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/side-panel/panel/SPanel.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { StoryObj, Meta } from '@storybook/react';
2 | import SidePanel from './SPanel';
3 | import logo from '../../../../../assets/icons/logo.svg?raw';
4 |
5 | const meta: Meta = {
6 | title: 'ui/components/molecules/side-panel/panel',
7 | component: SidePanel,
8 | argTypes: {
9 | onClick: {
10 | action: 'click',
11 | },
12 | },
13 | };
14 | export default meta;
15 |
16 | type Story = StoryObj;
17 |
18 | export const Primary: Story = {
19 | args: {
20 | icon: logo,
21 | color: 'primary',
22 | },
23 | };
24 |
25 | export const Secodary: Story = {
26 | args: {
27 | icon: logo,
28 | color: 'secondary',
29 | },
30 | };
31 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/side-panel/panel/SPanel.test.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from '@testing-library/react';
3 | import SPanel from './SPanel';
4 |
5 | describe('SPanel Component', () => {
6 | it('should render SPanel component', () => {
7 | const { getByTestId } = render();
8 | const panelElement = getByTestId('s-panel');
9 | expect(panelElement).toBeInTheDocument();
10 | });
11 | });
12 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/side-panel/panel/SPanel.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import type { IProps } from './types/IProps';
3 | import LogoFooter from '../../../atoms/logo-footer/LogoFooter';
4 | import Tags from '../../../atoms/Tags/Tags';
5 | import './SPanel.scss';
6 | import logo from '../../../../../assets/icons/logo.svg?raw';
7 |
8 | function SPanel({ color = 'primary' }: IProps) {
9 | const tags = ['workings', 'optimism', 'meaning', 'promoting'];
10 | const getColorClassName = () => {
11 | return color === 'primary' ? 'panel--primary' : 'panel--secondary';
12 | };
13 |
14 | return (
15 |
16 |
17 |
18 |
19 | );
20 | }
21 |
22 | export default SPanel;
23 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/side-panel/panel/types/IProps.ts:
--------------------------------------------------------------------------------
1 | export interface IProps {
2 | icon?: string | null;
3 | color?: 'primary' | 'secondary';
4 | onClick?: () => void;
5 | }
6 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/volume-box/types/IProps.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface IProps {
4 | children: React.ReactNode;
5 | className?: string;
6 | }
7 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/volume-carousel/types/IProps.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface IProps {
4 | children: React.ReactNode;
5 | rightIcon?: string;
6 | leftIcon?: string;
7 | }
8 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/volume-list/VolumeList.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { StoryObj, Meta } from '@storybook/react';
2 | import VolumeList from './VolumeList';
3 |
4 | const meta: Meta = {
5 | title: 'ui/components/molecules/volume-list',
6 | component: VolumeList,
7 | };
8 |
9 | export default meta;
10 |
11 | type Story = StoryObj;
12 |
13 | export const Default: Story = {};
14 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/volume-list/types/IProps.ts:
--------------------------------------------------------------------------------
1 | export interface IProps {
2 | id: number;
3 | attributes: {
4 | title: string;
5 | date: string;
6 | portrait: {
7 | data: {
8 | id: number;
9 | attributes: {
10 | url: string;
11 | };
12 | };
13 | };
14 | year_volume: {
15 | data: {
16 | id: number;
17 | attributes: {
18 | Year: string;
19 | Volumes: string;
20 | };
21 | };
22 | };
23 | };
24 | }
25 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/volume/Volume.scss:
--------------------------------------------------------------------------------
1 | .volume {
2 | align-items: center;
3 | display: flex;
4 | flex-direction: column;
5 | height: 100vh;
6 | justify-content: center;
7 | text-align: center;
8 |
9 | > * {
10 | margin: 10px 0;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/volume/Volume.tsx:
--------------------------------------------------------------------------------
1 | import './Volume.scss';
2 | import LabelVol from '../../atoms/label-vol/LabelVol';
3 | import LabelDate from '../../atoms/label-date/LabelDate';
4 | import Thumbnail from '../../atoms/thumbnail/Thumbnail';
5 | import type { IProps } from './types/IProps';
6 |
7 | function Volume({ pathImage, alt, volumen, id, date, overflow }: IProps) {
8 | return (
9 |
10 |
11 |
12 |
13 |
14 | );
15 | }
16 |
17 | export default Volume;
18 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/volume/types/IProps.ts:
--------------------------------------------------------------------------------
1 | import type { IProps as IThumbnailProps } from 'ui/components/atoms/thumbnail/types/IProps';
2 | import type { IProps as ILabelVolProps } from 'ui/components/atoms/label-vol/types/IProps';
3 | import type { IProps as ILabelDateProps } from 'ui/components/atoms/label-date/types/IProps';
4 |
5 | export interface IProps extends IThumbnailProps, ILabelVolProps, ILabelDateProps {}
6 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/year-list/YearList.scss:
--------------------------------------------------------------------------------
1 | @import '../../../../globals/variables';
2 | @import '../../../../globals/mixins';
3 |
4 | .year-list__wrapper {
5 | display: flex;
6 | flex-direction: column;
7 | justify-content: center;
8 | }
9 |
10 | @include respond-to('medium') {
11 | .year-list__wrapper {
12 | align-items: center;
13 | }
14 | }
15 |
16 | .year-list__container {
17 | display: grid;
18 | grid-template-columns: repeat(auto-fit, minmax(2.5rem, 1fr));
19 | margin-top: 1rem;
20 | place-items: center center;
21 | width: 100%;
22 | }
23 |
24 | .year-list__hidden {
25 | display: none;
26 | }
27 |
28 | @include respond-to('medium') {
29 | .year-list__container {
30 | grid-template-columns: repeat(auto-fit, minmax(6.25rem, 1fr));
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/year-list/YearList.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { StoryObj, Meta } from '@storybook/react';
2 | import YearList from './YearList';
3 | import dataMock from './__mock__/datamock.json';
4 |
5 | const meta: Meta = {
6 | title: 'ui/components/molecules/year-list',
7 | component: YearList,
8 | };
9 |
10 | export default meta;
11 |
12 | type Story = StoryObj;
13 |
14 | export const Default: Story = {
15 | args: {
16 | data: dataMock.data,
17 | buttonText: 'año',
18 | },
19 | };
20 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/year-list/YearList.test.tsx:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import { describe, it, expect } from 'vitest';
3 | import YearList from './YearList';
4 | import dataMock from './__mock__/datamock.json';
5 |
6 | describe('YearList', () => {
7 | it('should render the correct text button', () => {
8 | render();
9 |
10 | expect(screen.getByText(/año/i)).toBeInTheDocument();
11 | });
12 | });
13 |
--------------------------------------------------------------------------------
/src/ui/components/molecules/year-list/types/IProps.ts:
--------------------------------------------------------------------------------
1 | export interface IAttributes {
2 | Year: string;
3 | Volumes: string;
4 | }
5 |
6 | export interface IData {
7 | id: number;
8 | attributes: IAttributes;
9 | }
10 |
11 | export interface IProps {
12 | data: IData[];
13 | buttonText: string;
14 | }
15 |
--------------------------------------------------------------------------------
/src/ui/components/organisms/articles-page/ArticlesPage.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from '@storybook/react';
2 | import ArticlesPage from './ArticlesPage';
3 |
4 | const meta: Meta = {
5 | title: 'ui/components/organisms/articles-page',
6 | component: ArticlesPage,
7 | parameters: {
8 | layout: 'fullscreen',
9 | },
10 | };
11 |
12 | export default meta;
13 |
14 | type Story = StoryObj;
15 |
16 | export const Default: Story = {};
17 |
--------------------------------------------------------------------------------
/src/ui/components/organisms/articles-page/ArticlesPage.test.jsx:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import ArticlesPage from './ArticlesPage.tsx';
3 |
4 | describe('ArticlesPage', () => {
5 | beforeEach(() => {
6 | render();
7 | });
8 |
9 | test('renders the "ARTÍCULOS" label', () => {
10 | const articlesLabel = screen.getByText('ARTÍCULOS');
11 | expect(articlesLabel).toBeInTheDocument();
12 | });
13 |
14 | test('renders the "VOLÚMENES" label', () => {
15 | const volumesLabel = screen.getByText('VOLÚMENES');
16 | expect(volumesLabel).toBeInTheDocument();
17 | });
18 |
19 | test('renders volume labels in the carousel', () => {
20 | const volumes = screen.getAllByText(/Vol\./);
21 | expect(volumes.length).toBe(4);
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/src/ui/components/organisms/demo-branch-story/demo-branch-story.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { Meta, StoryObj } from '@storybook/react';
2 | import { DemoBranchStory } from './demo-branch-story';
3 |
4 | const meta: Meta = {
5 | title: 'Organisms/DemoBranchStory',
6 | component: DemoBranchStory,
7 | parameters: {
8 | layout: 'fullscreen',
9 | },
10 | };
11 |
12 | export default meta;
13 |
14 | type Story = StoryObj;
15 |
16 | export const Default: Story = {
17 | args: {},
18 | };
19 |
20 | export const WithTheme: Story = {
21 | args: {},
22 | decorators: [
23 | (Story) => (
24 |
25 |
26 |
27 | ),
28 | ],
29 | };
30 |
--------------------------------------------------------------------------------
/src/ui/components/organisms/homepage/HomePage.stories.tsx:
--------------------------------------------------------------------------------
1 | import type { StoryObj, Meta } from '@storybook/react';
2 | import HomePage from './HomePage';
3 |
4 | const meta: Meta = {
5 | title: 'ui/components/organisms/homepage',
6 | component: HomePage,
7 | };
8 |
9 | export default meta;
10 |
11 | type Story = StoryObj;
12 |
13 | export const Default: Story = {};
14 |
--------------------------------------------------------------------------------
/src/ui/components/organisms/homepage/types/IProps.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface IProps {
4 | children?: React.ReactNode;
5 | }
6 |
--------------------------------------------------------------------------------
/src/ui/components/organisms/sectiontwo-page/__mock__/breakpoints.json:
--------------------------------------------------------------------------------
1 | {
2 | "small": "480px",
3 | "small-mobile": "320px",
4 | "small-mobile-large": "568px",
5 | "medium": "768px",
6 | "large": "1024px",
7 | "large-tablet": "1112px",
8 | "extra-large": "1280px"
9 | }
10 |
--------------------------------------------------------------------------------
/src/ui/components/organisms/sectiontwo-page/types/IProps.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface IProps {
4 | children: React.ReactNode;
5 | backgroundImageDesktop: string;
6 | backgroundImageMobile: string;
7 | }
8 |
--------------------------------------------------------------------------------
/src/ui/utils/hooks/useForm.ts:
--------------------------------------------------------------------------------
1 | import { useState } from 'react';
2 | import type { ChangeEvent } from 'react';
3 |
4 | type FormFields = Record;
5 |
6 | interface UseFormReturn {
7 | form: T;
8 | handlerChangeForm: (event: ChangeEvent) => void;
9 | handlerResetForm: () => void;
10 | }
11 |
12 | const useForm = (initForm: T): UseFormReturn => {
13 | const [form, setForm] = useState(initForm);
14 |
15 | const handlerChangeForm = ({ target }: ChangeEvent) => {
16 | setForm({ ...form, [target.name]: target.value });
17 | };
18 |
19 | const handlerResetForm = () => {
20 | setForm(initForm);
21 | };
22 |
23 | return { form, handlerChangeForm, handlerResetForm };
24 | };
25 |
26 | export default useForm;
27 |
--------------------------------------------------------------------------------
/src/ui/utils/svg-icons/optimizeSvg.ts:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line import/no-extraneous-dependencies
2 | import { optimize } from 'svgo';
3 |
4 | function optimizeSvg(svg: string, size = '24px') {
5 | const result = optimize(svg, {
6 | plugins: [
7 | {
8 | name: 'removeDimensions',
9 | },
10 | {
11 | name: 'addAttributesToSVGElement',
12 | params: {
13 | attributes: [
14 | {
15 | viewBox: `0 0 ${size.replace('px', '')} ${size.replace('px', '')}`,
16 | },
17 | ],
18 | },
19 | },
20 | ],
21 | });
22 |
23 | return result.data;
24 | }
25 |
26 | export default optimizeSvg;
27 |
--------------------------------------------------------------------------------
/src/ui/utils/svg-icons/types/SvgIconProps.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export interface SvgIconProps {
4 | src: string;
5 | size?: string;
6 | className?: string;
7 | styles?: React.CSSProperties;
8 | ['data-testid']?: string;
9 | }
10 |
--------------------------------------------------------------------------------
/src/ui/utils/vite-svgr/Icon.tsx:
--------------------------------------------------------------------------------
1 | import { useDynamicIcon } from '../hooks/useDynamicIcon';
2 | import type { IconProps } from './types/IProps';
3 | import { Loader } from './Loader';
4 |
5 | export function Icon({ iconName, ...props }: IconProps) {
6 | const [DynamicComponent] = useDynamicIcon(iconName);
7 |
8 | return (
9 |
10 | {DynamicComponent ? (
11 | // eslint-disable-next-line react/jsx-props-no-spreading
12 |
13 | ) : (
14 |
15 | )}
16 |
17 | );
18 | }
19 |
--------------------------------------------------------------------------------
/src/ui/utils/vite-svgr/Loader.tsx:
--------------------------------------------------------------------------------
1 | import { Box, CircularProgress } from '@mui/material';
2 | import ThemeWrapper from '../../../style-library/core/ThemeProvider';
3 |
4 | export function Loader() {
5 | return (
6 |
7 |
8 |
16 |
17 |
18 |
19 | );
20 | }
21 |
--------------------------------------------------------------------------------
/src/ui/utils/vite-svgr/loadSvgIcon.ts:
--------------------------------------------------------------------------------
1 | import type { DynamicIcon } from './types/IconType';
2 |
3 | export async function loadSvgIcon(iconName: string): Promise {
4 | const module = (await import(`../../../assets/icons/${iconName}.svg?react`)) as {
5 | default: DynamicIcon;
6 | };
7 | return module.default;
8 | }
9 |
--------------------------------------------------------------------------------
/src/ui/utils/vite-svgr/types/IProps.ts:
--------------------------------------------------------------------------------
1 | import type { SVGProps } from 'react';
2 |
3 | export interface IconProps extends SVGProps {
4 | iconName: IconName;
5 | }
6 |
7 | export type IconName =
8 | | 'article'
9 | | 'articles'
10 | | 'burger-menu'
11 | | 'button-burguer'
12 | | 'button-burguer1'
13 | | 'close_simple'
14 | | 'close'
15 | | 'downloads'
16 | | 'eye'
17 | | 'facebook'
18 | | 'facebook1'
19 | | 'facelocation'
20 | | 'google'
21 | | 'home'
22 | | 'icon-upload-default'
23 | | 'icon-upload-primary'
24 | | 'left-arrow'
25 | | 'location'
26 | | 'logo'
27 | | 'magnifyingglass'
28 | | 'media'
29 | | 'pdf'
30 | | 'reference'
31 | | 'reference1'
32 | | 'right-arrow'
33 | | 'share'
34 | | 'start'
35 | | 'telegram'
36 | | 'vector'
37 | | 'volume'
38 | | 'volumes'
39 | | 'whatsapp';
40 |
--------------------------------------------------------------------------------
/src/ui/utils/vite-svgr/types/IconType.ts:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import type { FunctionComponent } from 'react';
3 |
4 | export type DynamicIcon = FunctionComponent> | null;
5 |
--------------------------------------------------------------------------------
/style-guide/astro.js:
--------------------------------------------------------------------------------
1 | const { rules } = require('./rules/astro');
2 |
3 | module.exports = {
4 | extends: [
5 | require.resolve('./react'),
6 | require.resolve('./configurations/_base'),
7 | 'plugin:svelte/recommended',
8 | 'plugin:astro/recommended',
9 | ],
10 | ignorePatterns: ['app-server/**', '.yarn/**', 'Dockerfile'],
11 | overrides: [
12 | {
13 | files: ['*.astro'],
14 | parser: 'astro-eslint-parser',
15 | parserOptions: {
16 | parser: '@typescript-eslint/parser',
17 | extraFileExtensions: ['.astro'],
18 | },
19 | rules: rules,
20 | },
21 | {
22 | files: ['*.svelte'],
23 | parser: 'svelte-eslint-parser',
24 | parserOptions: {
25 | parser: {
26 | ts: '@typescript-eslint/parser',
27 | typescript: '@typescript-eslint/parser',
28 | },
29 | },
30 | },
31 | ],
32 | };
33 |
--------------------------------------------------------------------------------
/style-guide/configurations/constants.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | ECMA_VERSION: 2021,
3 | JAVASCRIPT_FILES: ['*.js?(x)', '*.mjs'],
4 | TYPESCRIPT_FILES: ['*.ts?(x)'],
5 | ASTRO_FILES: ['*.astro'],
6 | SVELTE_FILES: ['*.svelte'],
7 | TEST_FILES: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
8 | };
9 |
--------------------------------------------------------------------------------
/style-guide/configurations/ignorePattern.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | ignorePatterns: [
3 | 'node_modules/',
4 | 'dist/',
5 | 'build/',
6 | 'public/',
7 | 'stories',
8 | 'style-guide',
9 | 'agnosticStyles/',
10 | 'storybook-static/',
11 | 'storybook-global/',
12 | '.eslintrc.js',
13 | '.eslintrc.cjs',
14 | 'astro-config.ts',
15 | 'vite.config.ts',
16 | 'vite.config.js',
17 | 'vitest.config.unit.ts',
18 | 'vitest.config.e2e.ts',
19 | '*.d.ts',
20 | 'vite.config.ts.timestamp-*.mjs',
21 | ],
22 | };
23 |
--------------------------------------------------------------------------------
/style-guide/configurations/typescript.js:
--------------------------------------------------------------------------------
1 | const { TYPESCRIPT_FILES } = require('./constants.js');
2 | module.exports = {
3 | overrides: [
4 | {
5 | files: TYPESCRIPT_FILES,
6 | extends: [
7 | 'plugin:@typescript-eslint/recommended',
8 | 'plugin:@typescript-eslint/recommended-type-checked',
9 | 'plugin:@typescript-eslint/strict',
10 | 'plugin:@typescript-eslint/strict-type-checked',
11 | 'plugin:@typescript-eslint/stylistic',
12 | 'plugin:@typescript-eslint/stylistic-type-checked',
13 | 'plugin:import/typescript',
14 | 'airbnb-typescript',
15 | 'prettier',
16 | ],
17 | rules: {
18 | 'import/prefer-default-export': 0,
19 | },
20 | },
21 | ],
22 | };
23 |
--------------------------------------------------------------------------------
/style-guide/configurations/vitest.js:
--------------------------------------------------------------------------------
1 | const { TEST_FILES } = require('./constants.js');
2 | module.exports = {
3 | overrides: [
4 | {
5 | files: TEST_FILES,
6 | plugins: ['vitest'],
7 | extends: ['plugin:vitest/recommended'],
8 | rules: {
9 | 'import/no-extraneous-dependencies': [
10 | 'off',
11 | { devDependencies: ['**/*.test.[jt]s?(x)', '**/*.spec.[jt]s?(x)'] },
12 | ],
13 | },
14 | },
15 | ],
16 | };
17 |
--------------------------------------------------------------------------------
/style-guide/prettier/config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: [require.resolve('prettier-plugin-astro'), require.resolve('prettier-plugin-svelte')],
3 | overrides: [
4 | {
5 | files: '*.astro',
6 | options: {
7 | parser: 'astro',
8 | },
9 | },
10 | { files: '*.svelte', options: { parser: 'svelte' } },
11 | ],
12 | arrowParens: 'always',
13 | bracketSpacing: true,
14 | printWidth: 100,
15 | proseWrap: 'preserve',
16 | requirePragma: false,
17 | semi: true,
18 | singleQuote: true,
19 | tabWidth: 2,
20 | trailingComma: 'all',
21 | useTabs: false,
22 | svelteSortOrder: 'options-styles-scripts-markup',
23 | svelteStrictMode: true,
24 | svelteAllowShorthand: false,
25 | svelteIndentScriptAndStyle: false,
26 | endOfLine: 'lf',
27 | };
28 |
--------------------------------------------------------------------------------
/style-guide/rules/base.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | rules: {
3 | 'max-len': ['error', { code: 150 }],
4 | 'import/no-named-as-default': 0,
5 | 'import/no-named-as-default-member': 0,
6 | 'import/prefer-default-export': 0,
7 | 'react/jsx-filename-extension': 'off',
8 | 'react/require-default-props': 'off',
9 | },
10 | };
11 |
--------------------------------------------------------------------------------
/style-guide/rules/nomenclature.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | rules: {
3 | 'check-file/no-index': 'off',
4 | 'check-file/filename-blocklist': ['error', {}],
5 | 'check-file/folder-match-with-fex': [
6 | 'off',
7 | {
8 | '*.test.{js,jsx,ts,tsx}': '**/__tests__/',
9 | },
10 | ],
11 | 'check-file/filename-naming-convention': [
12 | 'error',
13 | {
14 | '{**/!(index|main).{jsx,tsx,svelte},**/!(*pages*)/!/^[A-Z]([A-Za-z0-9]+)?([w+])?.astro$/':
15 | 'PASCAL_CASE',
16 | '{**/!(index|main).{js,ts}}': 'KEBAB_CASE',
17 | },
18 | { ignoreMiddleExtensions: true },
19 | ],
20 | 'check-file/folder-naming-convention': [
21 | 'error',
22 | {
23 | '**/!(__tests__|.)': 'KEBAB_CASE',
24 | },
25 | ],
26 | },
27 | };
28 |
--------------------------------------------------------------------------------
/style-guide/tsconfig/base.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json.schemastore.org/tsconfig",
3 | "compilerOptions": {
4 | "declaration": true,
5 | "declarationMap": true,
6 | "inlineSources": false,
7 | "noUnusedLocals": false,
8 | "noUnusedParameters": false,
9 | "preserveWatchOutput": true,
10 | "target": "ESNext",
11 | "module": "ESNext",
12 | "moduleResolution": "Bundler",
13 | "allowImportingTsExtensions": true,
14 | "resolveJsonModule": true,
15 | "verbatimModuleSyntax": true,
16 | "isolatedModules": true,
17 | "noEmit": true,
18 | "forceConsistentCasingInFileNames": true,
19 | "esModuleInterop": true,
20 | "skipLibCheck": true,
21 | "allowJs": true,
22 | "strict": true,
23 | "strictNullChecks": true,
24 | "plugins": [
25 | {
26 | "name": "typescript-plugin-css-modules"
27 | }
28 | ]
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json.schemastore.org/tsconfig",
3 | "display": "Astro Project",
4 | "extends": "./style-guide/tsconfig/base.json",
5 | "compilerOptions": {
6 | "baseUrl": "./src",
7 | "paths": {
8 | "@PubSub/*": ["./PubSub/*"],
9 | "@icons": ["./ui/utils/svg-icons/icons"],
10 | "@services/*": ["./services/*"]
11 | },
12 | "jsx": "react-jsx",
13 | "jsxImportSource": "react",
14 | "plugins": [
15 | {
16 | "name": "@astrojs/ts-plugin"
17 | }
18 | ]
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite';
2 | import react from '@vitejs/plugin-react';
3 |
4 | export default defineConfig({
5 | plugins: [react()],
6 | test: {
7 | globals: true,
8 | environment: 'jsdom',
9 | setupFiles: './src/setupTests.ts',
10 | },
11 | });
12 |
--------------------------------------------------------------------------------