Skip to content

Commit

Permalink
fix(elements)!: switch IconBox wrapper element from a div to a span
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `<IconButton />` is now a span instead of a div.
  • Loading branch information
ivangabriele committed May 2, 2024
1 parent 8a19fe6 commit 4a17f10
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/components/Dropdown/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ const PrimaryDropdownItem = styled(RsuiteDropdown.Item as any)<{
&:not(:last-child) {
border-bottom: 1px solid var(--lightGray);
}
/* SVG Icon Components are wrapped within a <div /> */
> div {
> .Element-IconBox {
margin-top: 1px;
}
`
3 changes: 1 addition & 2 deletions src/components/Dropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ const PrimaryDropdown = styled(RsuiteDropdown as any)<{
color: ${p => p.theme.color.cultured};
}
/* SVG Icon Components are wrapped within a <div /> */
> div {
> .Element-IconBox {
margin: 1px 8px 0 0;
}
Expand Down
3 changes: 1 addition & 2 deletions src/elements/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ const StyledButton = styled.button<{
padding: ${p => PADDING[p.size]};
width: ${p => (p.isFullWidth ? '100%' : 'auto')};
/* SVG Icon Components are wrapped within a <div /> */
> div {
> .Element-IconBox {
margin-right: 5px;
}
`
Expand Down
4 changes: 2 additions & 2 deletions src/elements/IconBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import styled from 'styled-components'

import type { HTMLAttributes } from 'react'

export type IconBoxProps = HTMLAttributes<HTMLDivElement> & {
export type IconBoxProps = HTMLAttributes<HTMLSpanElement> & {
$color?: string | undefined
/** In pixels */
$size?: number | undefined
}
/**
* Internal component used to wrap SVG icon components
*/
export const IconBox = styled.div.attrs<IconBoxProps, IconBoxProps>(() => ({
export const IconBox = styled.span.attrs<IconBoxProps, IconBoxProps>(() => ({
className: 'Element-IconBox'
}))`
display: inline-block;
Expand Down
4 changes: 2 additions & 2 deletions src/elements/Tag/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ const Box = styled.span<{
height: 22px;
line-height: normal;
padding: ${p => (p.$withCircleIcon ? '1px 8px 0px 1px' : '0px 8px')};
/* SVG Icon components are wrapped within a <div /> */
> div {
> .Element-IconBox {
margin-right: 4px;
}
`
Expand Down

0 comments on commit 4a17f10

Please sign in to comment.