Skip to content

Commit

Permalink
fix: prevent radio criterion shrinking and improve alignment
Browse files Browse the repository at this point in the history
- Add flexShrink: 0 style to prevent radio button compression
- Add align-items-center class for better vertical alignment
  • Loading branch information
milad-emami authored and CodeWithEmad committed Nov 20, 2024
1 parent 76f4143 commit c15680c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/containers/CriterionContainer/RadioCriterion.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ export class RadioCriterion extends React.Component {
<Form.RadioSet name={config.name} value={data}>
{config.options.map((option) => (
<Form.Radio
className="criteria-option"
className="criteria-option align-items-center"
key={option.name}
value={option.name}
description={intl.formatMessage(messages.optionPoints, { points: option.points })}
onChange={this.onChange}
disabled={!isGrading}
style={{ flexShrink: 0 }}
>
{option.label}
</Form.Radio>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,31 @@ exports[`Radio Criterion Container snapshot is grading 1`] = `
value="selected radio option"
>
<Form.Radio
className="criteria-option"
className="criteria-option align-items-center"
description="1 points"
disabled={false}
key="option name"
onChange={[Function]}
style={
{
"flexShrink": 0,
}
}
value="option name"
>
this label
</Form.Radio>
<Form.Radio
className="criteria-option"
className="criteria-option align-items-center"
description="2 points"
disabled={false}
key="option name 2"
onChange={[Function]}
style={
{
"flexShrink": 0,
}
}
value="option name 2"
>
this label 2
Expand All @@ -34,21 +44,31 @@ exports[`Radio Criterion Container snapshot is not grading 1`] = `
value="selected radio option"
>
<Form.Radio
className="criteria-option"
className="criteria-option align-items-center"
description="1 points"
disabled={true}
key="option name"
onChange={[Function]}
style={
{
"flexShrink": 0,
}
}
value="option name"
>
this label
</Form.Radio>
<Form.Radio
className="criteria-option"
className="criteria-option align-items-center"
description="2 points"
disabled={true}
key="option name 2"
onChange={[Function]}
style={
{
"flexShrink": 0,
}
}
value="option name 2"
>
this label 2
Expand All @@ -62,21 +82,31 @@ exports[`Radio Criterion Container snapshot radio contain invalid response 1`] =
value="selected radio option"
>
<Form.Radio
className="criteria-option"
className="criteria-option align-items-center"
description="1 points"
disabled={false}
key="option name"
onChange={[Function]}
style={
{
"flexShrink": 0,
}
}
value="option name"
>
this label
</Form.Radio>
<Form.Radio
className="criteria-option"
className="criteria-option align-items-center"
description="2 points"
disabled={false}
key="option name 2"
onChange={[Function]}
style={
{
"flexShrink": 0,
}
}
value="option name 2"
>
this label 2
Expand Down

0 comments on commit c15680c

Please sign in to comment.