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(axis): include defaultTextProps in Axis labelProps #1791

Merged
merged 4 commits into from
Jan 25, 2024
Merged
Changes from 1 commit
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
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
}
RyKilleen marked this conversation as resolved.
Show resolved Hide resolved
RyKilleen marked this conversation as resolved.
Show resolved Hide resolved
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,
RyKilleen marked this conversation as resolved.
Show resolved Hide resolved
orientation,
range: scale.range(),
tickLabelFontSize: maxTickLabelFontSize,
tickLength,
})}
{...labelProps}
{...labelPropsDefault}
RyKilleen marked this conversation as resolved.
Show resolved Hide resolved
>
{label}
</Text>
Expand Down
Loading