Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/table
Browse files Browse the repository at this point in the history
  • Loading branch information
rinrub committed Jan 25, 2024
2 parents 1dc0edc + 51b8891 commit ee0bd1d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
- Added table feature to new major version

---
## 14.0.1

---

- fixed slidercomponent not showing children

## 14.0.0

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@helsenorge/refero",
"version": "14.0.0-beta02",
"version": "14.0.1",
"engines": {
"node": "^18.0.0",
"npm": ">=9.0.0"
Expand Down
6 changes: 5 additions & 1 deletion src/components/formcomponents/choice/choice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,11 @@ export class Choice extends React.Component<ChoiceProps & ValidationProps, Choic
};

renderSlider = (): JSX.Element => {
return <SliderView item={this.props.item} handleChange={this.handleChange} />;
return (
<SliderView item={this.props.item} handleChange={this.handleChange}>
{this.props.children}
</SliderView>
);
};

renderAutosuggest = (): JSX.Element => {
Expand Down
12 changes: 10 additions & 2 deletions src/components/formcomponents/choice/slider-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import { getExtension } from '../../../util/extension';
interface SliderProps {
item: QuestionnaireItem;
handleChange: (sliderStep: string) => void;
children: React.ReactNode;
}

type LeftRightLabels = [leftLabel: string, rightLabel: string];

const SliderView: React.FC<SliderProps> = ({ item, handleChange }) => {
const SliderView: React.FC<SliderProps> = ({ item, handleChange, children }) => {
const title = item.text;
const [sliderSteps, setSliderSteps] = React.useState<SliderStep[] | undefined>(undefined);
const [leftRightLabels, setleftRightLabels] = React.useState<LeftRightLabels | undefined>(undefined);
Expand All @@ -36,7 +37,14 @@ const SliderView: React.FC<SliderProps> = ({ item, handleChange }) => {

return (
<div className="page_refero__component page_refero__component_choice page_refero__component_choice_slider">
<Slider title={title} labelLeft={leftRightLabels?.[0]} labelRight={leftRightLabels?.[1]} onChange={onValueChange} steps={sliderSteps} />
<Slider
title={title}
labelLeft={leftRightLabels?.[0]}
labelRight={leftRightLabels?.[1]}
onChange={onValueChange}
steps={sliderSteps}
/>
{children ? <div className="nested-fieldset nested-fieldset--full-height">{children}</div> : undefined}
</div>
);
};
Expand Down
6 changes: 5 additions & 1 deletion src/components/formcomponents/open-choice/open-choice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,11 @@ export class OpenChoice extends React.Component<Props & ValidationProps> {
};

renderSlider = (): JSX.Element => {
return <SliderView item={this.props.item} handleChange={this.handleChange} />;
return (
<SliderView item={this.props.item} handleChange={this.handleChange}>
{this.props.children}
</SliderView>
);
};

shouldComponentUpdate(nextProps: Props): boolean {
Expand Down

0 comments on commit ee0bd1d

Please sign in to comment.