colouring-montreal/app/src/frontend/building/data-components/user-opinion-data-entry.tsx

39 lines
1.1 KiB
TypeScript
Raw Normal View History

2019-08-14 16:54:31 -04:00
import React, { Fragment } from 'react';
import { NavLink } from 'react-router-dom';
import { CopyProps } from '../data-containers/category-view-props';
import { DataTitleCopyable } from './data-title';
2019-08-14 16:54:31 -04:00
interface UserOpinionEntryProps {
slug: string;
title: string;
mode: 'view' | 'edit' | 'multi-edit';
userValue: boolean;
copy: CopyProps;
onChange: (key: string, value: boolean) => void;
}
const UserOpinionEntry: React.FunctionComponent<UserOpinionEntryProps> = (props) => {
2019-08-14 16:54:31 -04:00
return (
2021-08-12 16:11:00 -04:00
<>
<DataTitleCopyable
slug={props.slug}
title={props.title}
copy={props.copy}
/>
2021-08-12 16:11:00 -04:00
<label className="form-check-label">
<input className="form-check-input" type="checkbox"
name={props.slug}
checked={!!props.userValue}
2021-08-12 16:11:00 -04:00
disabled={props.mode === 'view'}
onChange={e => props.onChange(props.slug, e.target.checked)}
/> Yes
2021-08-12 16:11:00 -04:00
</label>
</>
2019-08-14 16:54:31 -04:00
);
2019-11-07 03:13:30 -05:00
};
2019-08-14 16:54:31 -04:00
export default UserOpinionEntry;