Skip to content

Commit

Permalink
fix: include defaultTextProps in Axis labelProps
Browse files Browse the repository at this point in the history
This enables passing of partial labelProps per the docs.
  • Loading branch information
RyKilleen committed Jan 19, 2024
1 parent eddcca4 commit a69620c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/visx-axis/src/axis/AxisRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function AxisRenderer<Scale extends AxisScale>({
label = '',
labelClassName,
labelOffset = 14,
labelProps = defaultTextProps,
labelProps,
orientation = Orientation.bottom,
scale,
stroke = '#222',
Expand All @@ -42,6 +42,10 @@ export default function AxisRenderer<Scale extends AxisScale>({
ticks,
ticksComponent = Ticks,
}: AxisRendererProps<Scale>) {
const labelPropsDefault = {
...defaultTextProps,
...labelProps
}
const tickLabelPropsDefault = {
...defaultTextProps,
...(typeof tickLabelProps === 'object' ? tickLabelProps : null),
Expand Down Expand Up @@ -89,13 +93,13 @@ export default function AxisRenderer<Scale extends AxisScale>({
className={cx('visx-axis-label', labelClassName)}
{...getLabelTransform({
labelOffset,
labelProps,
labelPropsDefault,
orientation,
range: scale.range(),
tickLabelFontSize: maxTickLabelFontSize,
tickLength,
})}
{...labelProps}
{...labelPropsDefault}
>
{label}
</Text>
Expand Down

0 comments on commit a69620c

Please sign in to comment.