Skip to content

Commit

Permalink
fix: Adjust property components for backwards compatibility (#524)
Browse files Browse the repository at this point in the history
  • Loading branch information
maciaszczykm authored Oct 11, 2023
1 parent 7418833 commit 49c65e0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
22 changes: 13 additions & 9 deletions src/components/Prop.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
import { Div, type DivProps } from 'honorable'
import styled from 'styled-components'

const PropSC = styled.div(({ theme }) => ({
margin: theme.spacing.medium,
const PropSC = styled.div<{ $margin?: string | number }>(
({ $margin, theme }) => ({
margin: $margin ?? theme.spacing.medium,

'.prop-title': {
...theme.partials.text.caption,
color: theme.colors['text-xlight'],
marginBottom: theme.spacing.xxsmall,
},
}))
'.prop-title': {
...theme.partials.text.caption,
color: theme.colors['text-xlight'],
marginBottom: theme.spacing.xxsmall,
},
})
)

export default function Prop({
children,
title,
margin,
...props
}: {
title: string
margin?: string | number
} & DivProps) {
return (
<PropSC>
<PropSC $margin={margin}>
<div className="prop-title">{title}</div>
<Div {...props}>{children}</Div>
</PropSC>
Expand Down
2 changes: 1 addition & 1 deletion src/components/PropsContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function PropsContainer({
title,
...props
}: {
title: string
title?: string
} & DivProps) {
return (
<PropsContainerSC {...props}>
Expand Down

0 comments on commit 49c65e0

Please sign in to comment.