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

change slider to radio buttons in judge #456

Merged
merged 9 commits into from
Apr 17, 2024
Merged
Changes from 5 commits
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
30 changes: 28 additions & 2 deletions components/judges/ScoreInput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Slider, InputNumber, Row, Col } from 'antd';
import { Slider, Radio, InputNumber, Row, Col } from 'antd';
import { RadioChangeEvent } from 'antd/lib';
import { IntegerType } from 'mongodb';
import React from 'react';
interface ScoreInputProps {
value: number;
Expand All @@ -8,10 +10,34 @@ interface ScoreInputProps {
export default function ScoreInput(props: ScoreInputProps) {
const { value, onChange } = props;
const [min, max] = [0, 7];
const onRadioChange = (e: RadioChangeEvent) => {
onChange(e.target.value);
};

return (
<Row>
<Col span={20}>
<Slider min={min} max={max} onChange={onChange} value={value} />
<Radio.Group onChange={onRadioChange} value={value}>
<Radio style={{ marginRight: '20px' }} value={1}>
1
</Radio>
<Radio style={{ marginRight: '20px' }} value={2}>
2
</Radio>
<Radio style={{ marginRight: '20px' }} value={3}>
3
</Radio>
<Radio style={{ marginRight: '20px' }} value={4}>
4
</Radio>
<Radio style={{ marginRight: '20px' }} value={5}>
5
</Radio>
<Radio style={{ marginRight: '20px' }} value={6}>
6
</Radio>
<Radio value={7}>7</Radio>
</Radio.Group>
</Col>
<Col span={4}>
<InputNumber
Expand Down
Loading