Skip to content

Commit

Permalink
🐛 fix type error
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Dec 3, 2024
1 parent ce3e37a commit 8bac63c
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions packages/@ourworldindata/grapher/src/lineLegend/LineLegend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -381,17 +381,16 @@ export class LineLegend extends React.Component<LineLegendProps> {
const maxAnnotationWidth = Math.min(maxTextWidth, 150)

return this.props.labelSeries.map((label) => {
const labelFragments = excludeUndefined([
{ text: label.label, fontWeight },
label.formattedValue
? {
text: label.formattedValue,
newLine: label.placeFormattedValueInNewLine
? "always"
: "avoid-wrap",
}
: undefined,
])
const mainLabel = { text: label.label, fontWeight }
const valueLabel = label.formattedValue
? {
text: label.formattedValue,
newLine: (label.placeFormattedValueInNewLine
? "always"
: "avoid-wrap") as "always" | "avoid-wrap",
}
: undefined
const labelFragments = excludeUndefined([mainLabel, valueLabel])
const textWrap = new TextWrapGroup({
fragments: labelFragments,
maxWidth: maxTextWidth,
Expand Down

0 comments on commit 8bac63c

Please sign in to comment.