Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: divider margin #508

Merged
merged 2 commits into from
Jan 9, 2025
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
14 changes: 7 additions & 7 deletions src/components/experimental/Divider/Divider.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ describe('Experimental: Divider', () => {
const dividerInstance = screen.getByTestId('vertical-divider-experimental');
const dividerStyle = window.getComputedStyle(dividerInstance);

expect(dividerStyle.marginTop).toBe('1rem');
expect(dividerStyle.marginBottom).toBe('1rem');
expect(dividerStyle.marginTop).toBe('0.5rem');
expect(dividerStyle.marginBottom).toBe('0.5rem');
});

it('renders vertical divider with 1rem offset when variant is inset', () => {
render(<Divider vertical variant="inset" />);
const dividerInstance = screen.getByTestId('vertical-divider-experimental');
const dividerStyle = window.getComputedStyle(dividerInstance);

expect(dividerStyle.marginTop).toBe('1rem');
expect(dividerStyle.marginTop).toBe('0.5rem');
expect(dividerStyle.marginBottom).toBe('');
});

Expand All @@ -57,7 +57,7 @@ describe('Experimental: Divider', () => {
const dividerStyle = window.getComputedStyle(dividerInstance);

expect(dividerStyle.marginRight).toBe('');
expect(dividerStyle.marginLeft).toBe('1rem');
expect(dividerStyle.marginLeft).toBe('0.5rem');
});

it('renders horizontal divider with overridden offset when variant is inset', () => {
Expand All @@ -74,8 +74,8 @@ describe('Experimental: Divider', () => {
const dividerInstance = screen.getByTestId('horizontal-divider-experimental');
const dividerStyle = window.getComputedStyle(dividerInstance);

expect(dividerStyle.marginRight).toBe('1rem');
expect(dividerStyle.marginLeft).toBe('1rem');
expect(dividerStyle.marginRight).toBe('0.5rem');
expect(dividerStyle.marginLeft).toBe('0.5rem');
});

it('renders horizontal divider with overridden offset when variant is middle-inset', () => {
Expand All @@ -84,6 +84,6 @@ describe('Experimental: Divider', () => {
const dividerStyle = window.getComputedStyle(dividerInstance);

expect(dividerStyle.marginRight).toBe('2rem');
expect(dividerStyle.marginLeft).toBe('1rem');
expect(dividerStyle.marginLeft).toBe('0.5rem');
});
});
12 changes: 6 additions & 6 deletions src/components/experimental/Divider/Divider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ const horizontalVariants = variant({
minWidth: '100%'
},
inset: {
marginLeft: '1rem'
marginLeft: '0.5rem'
},
'middle-inset': {
marginLeft: '1rem',
marginRight: '1rem'
marginLeft: '0.5rem',
marginRight: '0.5rem'
}
}
});
Expand All @@ -38,11 +38,11 @@ const verticalVariants = variant({
minHeight: '100%'
},
inset: {
marginTop: '1rem'
marginTop: '0.5rem'
},
'middle-inset': {
marginTop: '1rem',
marginBottom: '1rem'
marginTop: '0.5rem',
marginBottom: '0.5rem'
}
}
});
Expand Down
Loading