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
4 changes: 2 additions & 2 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ const config: StorybookConfig = {
'@storybook/addon-links',
'@chromatic-com/storybook',
'@storybook/addon-themes',
'@storybook/addon-docs'
'@storybook/addon-docs',
],

framework: {
name: '@storybook/react-vite',
options: {},
}
},
};
export default config;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@internxt/ui",
"version": "0.1.28",
"version": "0.1.29",
"description": "Library of Internxt components",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion src/components/feedback/notifications/usageBanner/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default as UsageWarningBanner } from './UsageWarningBanner';
export type { UsageWarningBannerProps } from './UsageWarningBanner';
export type { UsageWarningBannerProps } from './UsageWarningBanner';
2 changes: 1 addition & 1 deletion src/components/input/slider/__test__/RangeSlider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { RangeSlider } from '../';

describe('RangeSlider component', () => {
it('should match snapshot', () => {
const loader = render(<RangeSlider value={50} max={100} onChange={() => { }} />);
const loader = render(<RangeSlider value={50} max={100} onChange={() => {}} />);
expect(loader).toMatchSnapshot();
});

Expand Down
8 changes: 6 additions & 2 deletions src/components/layout/grid/__test__/Grid.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Grid component', () => {
<Grid>
<div>Item 1</div>
<div>Item 2</div>
</Grid>
</Grid>,
);
expect(getByText('Item 1')).toBeInTheDocument();
expect(getByText('Item 2')).toBeInTheDocument();
Expand All @@ -40,7 +40,11 @@ describe('Grid component', () => {
});

it('should assign id and data-cy correctly', () => {
const { container } = render(<Grid id="grid-id" dataCy="grid-data-cy">Test</Grid>);
const { container } = render(
<Grid id="grid-id" dataCy="grid-data-cy">
Test
</Grid>,
);
const gridDiv = container.firstChild as HTMLElement;

expect(gridDiv).toHaveAttribute('id', 'grid-id');
Expand Down
3 changes: 1 addition & 2 deletions src/components/mail/tray/__test__/MessageCheap.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ const mockEmail = {

const mockOnClick = vi.fn();

const renderMessageCheap = (props = {}) =>
render(<MessageCheap email={mockEmail} onClick={mockOnClick} {...props} />);
const renderMessageCheap = (props = {}) => render(<MessageCheap email={mockEmail} onClick={mockOnClick} {...props} />);

describe('MessageCheap', () => {
afterEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { describe, it, expect, vi } from 'vitest';

describe('SuiteLauncher', () => {
it('should match snapshot', () => {
const suiteLauncher = render(<SuiteLauncher suiteArray={[]} />);;
const suiteLauncher = render(<SuiteLauncher suiteArray={[]} />);
expect(suiteLauncher).toMatchSnapshot();
});

Expand Down
72 changes: 39 additions & 33 deletions src/components/overlay/dialog/Dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useEffect } from 'react';
import { useState } from 'react';
import { Button } from '../../input/button';
import { createPortal } from 'react-dom';

export interface DialogProps {
isOpen: boolean;
Expand Down Expand Up @@ -109,43 +110,48 @@ const Dialog = ({

return (
<>
{isVisible && (
<div className={`fixed inset-0 z-50 ${isOpen ? '' : 'pointer-events-none'}`}>
{isVisible &&
createPortal(
<div
className={
`absolute inset-0 bg-gray-100/50 transition-opacity duration-150 ` +
`dark:bg-black/75 ${transitionOpacity}`
}
onClick={onClose}
data-testid="dialog-overlay"
></div>

<div
className={
`absolute left-1/2 top-1/2 w-full max-w-${maxWidth} -translate-x-1/2 -translate-y-1/2 transform ` +
`rounded-2xl bg-surface p-5 transition-all duration-150 dark:bg-gray-1 ${transitionScale} ${transitionOpacity}`
}
className={`fixed inset-0 z-[9999] ${isOpen ? '' : 'pointer-events-none'}`}
onMouseDown={(event) => event.stopPropagation()}
>
<div className="flex flex-col space-y-2">
<p className="text-2xl font-medium text-gray-100">{title}</p>
<p className="text-gray-60">{subtitle}</p>
</div>
<div
className={
`absolute inset-0 bg-gray-100/50 transition-opacity duration-150 ` +
`dark:bg-black/75 ${transitionOpacity}`
}
onClick={onClose}
data-testid="dialog-overlay"
></div>

<div
className={
`absolute left-1/2 top-1/2 w-full max-w-${maxWidth} -translate-x-1/2 -translate-y-1/2 transform ` +
`rounded-2xl bg-surface p-5 transition-all duration-150 dark:bg-gray-1 ${transitionScale} ${transitionOpacity}`
}
>
<div className="flex flex-col space-y-2">
<p className="text-2xl font-medium text-gray-100">{title}</p>
<p className="text-gray-60">{subtitle}</p>
</div>

<div className="mt-5 flex justify-end space-x-2">
<Button variant="secondary" onClick={onSecondaryAction} disabled={isLoading}>
{secondaryAction}
</Button>
<Button
onClick={onPrimaryAction}
loading={isLoading}
variant={primaryActionColor === 'primary' ? 'primary' : 'destructive'}
>
{primaryAction}
</Button>
<div className="mt-5 flex justify-end space-x-2">
<Button variant="secondary" onClick={onSecondaryAction} disabled={isLoading}>
{secondaryAction}
</Button>
<Button
onClick={onPrimaryAction}
loading={isLoading}
variant={primaryActionColor === 'primary' ? 'primary' : 'destructive'}
>
{primaryAction}
</Button>
</div>
</div>
</div>
</div>
)}
</div>,
document.body,
)}
</>
);
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/overlay/dialog/__test__/Dialog.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ describe('Dialog', () => {
});

it('should match snapshot', () => {
const { container } = renderDialog();
expect(container).toMatchSnapshot();
const { baseElement } = renderDialog();
expect(baseElement).toMatchSnapshot();
});

it('renders dialog content when open', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`Dialog > should match snapshot 1`] = `
<div>
<body>
<div />
<div
class="fixed inset-0 z-50 "
class="fixed inset-0 z-[9999] "
>
<div
class="absolute inset-0 bg-gray-100/50 transition-opacity duration-150 dark:bg-black/75 opacity-0"
Expand Down Expand Up @@ -58,5 +59,5 @@ exports[`Dialog > should match snapshot 1`] = `
</div>
</div>
</div>
</div>
</body>
`;
4 changes: 2 additions & 2 deletions src/stories/components/usageBanner/Banner.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ export const AlmostFull: Story = {
<>
<p>You may soon be unable to upload new files</p>
<p>
Upgrade now with an exclusive <strong>85% discount</strong> to continue storing and syncing your files
without limits
Upgrade now with an exclusive <strong>85% discount</strong> to continue storing and syncing your files without
limits
</p>
</>
),
Expand Down
Loading