semantic-ui-react#Radio JavaScript Examples
The following examples show how to use
semantic-ui-react#Radio.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PIDField.js From react-invenio-deposit with MIT License | 6 votes |
render() {
const { disabled, isManagedSelected, pidLabel } = this.props;
return (
<Form.Group inline>
<Form.Field>
{i18next.t('Do you already have a {{pidLabel}} for this upload?', {
pidLabel: pidLabel,
})}
</Form.Field>
<Form.Field width={2}>
<Radio
label={i18next.t('Yes')}
name="radioGroup"
value="unmanaged"
disabled={disabled}
checked={!isManagedSelected}
onChange={this.handleChange}
/>
</Form.Field>
<Form.Field width={2}>
<Radio
label={i18next.t('No')}
name="radioGroup"
value="managed"
disabled={disabled}
checked={isManagedSelected}
onChange={this.handleChange}
/>
</Form.Field>
</Form.Group>
);
}
Example #2
Source File: JobInput.js From nextfeathers with Apache License 2.0 | 5 votes |
JobInputForm = (props) => (
<div>
{props.hideInput && (
<div className="ui message">
<div className="header">
<a href="#" onClick={props.toggleInput}>
Update data?
</a>
</div>
</div>
)}
{!props.hideInput && (
<div>
<h3>Upload Job Description</h3>
<UploadForm
onSelect={props.onSelect}
onSubmit={props.onSubmit}
fileName={props.fileName}
/>
<h3> Or fill the form below:</h3>
<Form>
<Radio
label="Use inline field?"
toggle
onChange={props.handleChange}
defaultChecked={props.isInline}
style={{ float: "right" }}
/>
{_.map(formInputs, (items, name) => (
<FormGroup
key={name}
title={name}
inputs={items}
inputData={props.inputData}
isInline={props.isInline}
updateInput={props.updateInput}
/>
))}
<Button onClick={props.onSubmit}>Submit</Button>
</Form>
</div>
)}
</div>
)
Example #3
Source File: AwardResults.js From react-invenio-deposit with MIT License | 5 votes |
AwardResults = withState(
({
currentResultsState: results,
deserializeAward,
deserializeFunder,
computeFundingContents,
}) => {
return (
<FastField name="selectedFunding">
{({ form: { values, setFieldValue } }) => {
return (
<Item.Group>
{results.data.hits.map((award) => {
let funder = award?.funder;
const deserializedAward = deserializeAward(award);
const deserializedFunder = deserializeFunder(funder);
const funding = {
award: deserializedAward,
funder: deserializedFunder,
};
let {
headerContent,
descriptionContent,
awardOrFunder,
} = computeFundingContents(funding);
return (
<Item
key={deserializedAward.id}
onClick={() => setFieldValue('selectedFunding', funding)}
className="license-item"
>
<Radio
checked={
_get(values, 'selectedFunding.award.id') ===
funding.award.id
}
onChange={() => setFieldValue('selectedFunding', funding)}
/>
<Item.Content className="license-item-content">
<Header size="small">
{headerContent}
{awardOrFunder === 'award'
? award.number && (
<Label basic size="mini">
{award.number}
</Label>
)
: ''}
{awardOrFunder === 'award'
? award.url && (
<a
href={`${award.url}`}
target="_blank"
rel="noopener noreferrer"
>
<Icon
link
name="external alternate"
className="spaced-left"
/>
</a>
)
: ''}
</Header>
<Item.Description className="license-item-description">
{descriptionContent}
</Item.Description>
</Item.Content>
</Item>
);
})}
</Item.Group>
);
}}
</FastField>
);
}
)
Example #4
Source File: LicenseResults.js From react-invenio-deposit with MIT License | 5 votes |
LicenseResults = withState(
({ currentResultsState: results, serializeLicenses }) => {
const serializeLicenseResult = serializeLicenses
? serializeLicenses
: (result) => ({
title: result.title_l10n,
description: result.description_l10n,
id: result.id,
});
return (
<FastField name="selectedLicense">
{({ form: { values, setFieldValue } }) => (
<Item.Group>
{results.data.hits.map((result) => {
const title = result['title_l10n'];
const description = result['description_l10n'];
return (
<Item
key={title}
onClick={() =>
setFieldValue(
'selectedLicense',
serializeLicenseResult(result)
)
}
className="license-item mb-15"
>
<Radio
checked={_get(values, 'selectedLicense.title') === title}
onChange={() =>
setFieldValue(
'selectedLicense',
serializeLicenseResult(result)
)
}
{...(!description && { className: 'mt-0' })}
/>
<Item.Content className="license-item-content">
<Header size="small" className="mt-0">
{title}
</Header>
{
description &&
<Item.Description className="license-item-description">
{description}
</Item.Description>
}
</Item.Content>
</Item>
);
})}
</Item.Group>
)}
</FastField>
);
}
)
Example #5
Source File: ManageHaccWidget.jsx From HACC-Hui with MIT License | 4 votes |
render() {
// console.log(this.state);
return (
<div style={{ paddingBottom: '50px' }}>
<Grid container centered>
<Grid.Column>
<div style={{
backgroundColor: '#E5F0FE', padding: '1rem 0rem', margin: '2rem 0rem',
borderRadius: '2rem',
}}>
<Header as="h2" textAlign="center">Manage HACC</Header>
<Header as="h5" textAlign="center">
<Radio toggle label="Can Create Teams"
checked={this.state.canCreateTeams}
onChange={this.toggleTeam} />
<Radio toggle label="Can Change Challenges"
checked={this.state.canChangeChallenges}
onChange={this.toggleChallenge} />
</Header>
</div>
<Segment style={{
borderRadius: '1rem',
backgroundColor: '#E5F0FE',
}} className={'teamCreate'}>
<Header as="h2" textAlign="center" >Challenges</Header>
<Table fixed columns={5}>
<Table.Header>
<Table.Row>
<Table.HeaderCell width={2}>Title</Table.HeaderCell>
<Table.HeaderCell width={5}>Description</Table.HeaderCell>
<Table.HeaderCell width={2}>Submission Detail</Table.HeaderCell>
<Table.HeaderCell width={2}>Pitch</Table.HeaderCell>
<Table.HeaderCell width={2}>Edit</Table.HeaderCell>
<Table.HeaderCell width={2}>Delete</Table.HeaderCell>
</Table.Row>
</Table.Header>
{/* eslint-disable-next-line max-len */}
<Table.Body>{this.props.challenges.map((challenges => <ChallengesAdminWidget key={challenges._id} challenges={challenges} />
))}
</Table.Body>
</Table>
<div align='center'>
<Button style={{
color: 'white', backgroundColor: '#DB2828',
margin: '2rem 0rem',
}}><Link to={ROUTES.ADD_CHALLENGE} style={{ color: 'white' }}>Add Challenge</Link></Button>
</div>
<Header as="h2" textAlign="center">Skills</Header>
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Name</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell width={2}>Edit</Table.HeaderCell>
<Table.HeaderCell width={2}>Delete</Table.HeaderCell>
</Table.Row>
</Table.Header>
{/* eslint-disable-next-line max-len */}
<Table.Body>{this.props.skills.map((skills => <SkillsAdminWidget key={skills._id} skills={skills} />))}
</Table.Body>
</Table>
<div align='center'>
<Button style={{
color: 'white', backgroundColor: '#DB2828',
margin: '2rem 0rem',
}}><Link to={ROUTES.ADD_SKILL} style={{ color: 'white' }}>Add Skill</Link></Button>
</div>
<Header as="h2" textAlign="center">Tools</Header>
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Name</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell width={2}>Edit</Table.HeaderCell>
<Table.HeaderCell width={2}>Delete</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>{this.props.tools.map((tools => <ToolsAdminWidget key={tools._id} tools={tools} />))}
</Table.Body>
</Table>
<div align='center'>
<Button style={{
color: 'white', backgroundColor: '#DB2828',
margin: '2rem 0rem',
}}><Link to={ROUTES.ADD_TOOL} style={{ color: 'white' }}>Add Tool</Link></Button>
</div>
</Segment>
</Grid.Column>
</Grid>
</div>
);
}
Example #6
Source File: FormField.js From nextfeathers with Apache License 2.0 | 4 votes |
FormField = (props) => {
// console.log("PROPS", props);
const handleChange = (event, { name, value }) => {
if (props.updateInput) {
props.updateInput(name, value);
}
};
const handleRadioClick = (event) => {
const name = event.target.name;
const value = props.value === "Y" ? "N" : "Y";
props.updateInput(name, value);
};
const handleAddition = (event, { value, name }) => {
if (props.handleAddition) {
props.handleAddition(value, name);
}
};
const handleSearchChange = (event, search) => {
// console.log("DOSEARCH", search);
if (props.handleSearchChange) {
props.handleSearchChange(search.searchQuery);
}
};
const handleFocus = () => {
if (props.handleFocus) {
props.handleFocus();
}
};
const handleBlur = () => {
if (props.handleBlur) {
props.handleBlur();
}
};
const handleDropdownChange = (event, data) => {
const name = data.name;
const value = data.value;
props.updateInput(name, value);
};
const handleEditorChange = (value) => {
const name = props.name;
const valueget = value;
props.updateInput(name, valueget);
};
const handleUpload = (url) => {
if (props.autoGenerateFeatureImage) {
props.autoGenerateFeatureImage(url);
}
};
return (
<Form.Field>
<label>{props.label}</label>
{props.type === "text" && (
<Input
name={props.name}
value={props.value}
style={{ maxWidth: "100%" }}
onChange={handleChange}
onFocus={handleFocus}
onBlur={handleBlur}
/>
)}
{props.type === "textarea" && (
<TextArea
name={props.name}
value={props.value}
style={{ maxWidth: "100%", innerHeight: "300%" }}
onChange={handleChange}
/>
)}
{props.type === "radio" && (
<Radio
toggle
name={props.name}
checked={props.value === "Y"}
onClick={handleRadioClick}
/>
)}
{props.type === "dropdown" && (
<Dropdown
placeholder={props.placeholder || "Please choose"}
name={props.name}
selection
options={props.options}
onChange={handleChange}
/>
)}
{props.type === "dropdownMulti" && (
<Dropdown
placeholder={props.placeholder || "Please choose"}
name={props.name}
selection
search
options={props.options}
multiple
value={props.value ? props.value : []}
allowAdditions
onChange={handleDropdownChange}
onSearchChange={handleSearchChange}
onAddItem={handleAddition}
/>
)}
{props.type === "editor" && (
<RichTextEditor
key={props.postKey}
value={props.value}
onChange={handleEditorChange}
onUpload={handleUpload}
/>
)}
</Form.Field>
);
}
Example #7
Source File: AppMain.js From jee-dashboard with GNU General Public License v3.0 | 4 votes |
render () {
const {
data,
year,
round_no,
institute_type,
quota,
currPage,
count,
search,
clickedColumn,
direction,
activeIndexs,
institute_short,
program,
duration,
degree,
category,
pool,
userrank,
userdelta
} = this.state
return (
<div className='app-main' id='scroll-to-filter'>
<Segment>
<div className='primary-filters-margin'>
<div className='year-type'>
<div
className={
isBrowser ? 'year-round-browser' : 'year-round-mobile'
}
>
<div>
<Button
content='Year'
color='facebook'
className='year-button'
/>
<Dropdown
name='year'
value={year}
placeholder='All'
selection
compact
options={yearDropDownOptions}
onChange={this.handleChange}
/>
</div>
{year === '2021' && (
<div>
<Button
className={
isBrowser
? 'round-button-browser'
: 'round-button-mobile'
}
content='Round'
color='facebook'
/>
<Dropdown
name='round_no'
value={round_no}
placeholder='Round no'
selection
compact
options={roundDropDownOptions}
onChange={this.handleChange}
/>
</div>
)}
</div>
<div className='year-type-margin'>
<Form>
<Form.Group className='form-group-margin-bottom'>
<Form.Field>
<Button content='College' color='facebook' />
</Form.Field>
<Form.Field>
<Radio
className='college-margin'
label='IIT'
name='institute_type'
value='IIT'
checked={institute_type === 'IIT'}
onChange={this.handleChange}
/>
</Form.Field>
<Form.Field>
<Radio
className='college-margin'
label='NIT'
name='institute_type'
value='NIT'
checked={institute_type === 'NIT'}
onChange={this.handleChange}
/>
</Form.Field>
</Form.Group>
</Form>
</div>
{institute_type === 'NIT' && (
<div className='year-type-margin'>
<Form>
<Form.Group className='form-group-margin-bottom'>
<Form.Field>
<Button
content='State'
color='facebook'
className='state-button'
/>
</Form.Field>
<Form.Field>
<Radio
className='college-margin'
label='HS'
name='quota'
value='HS'
checked={quota === 'HS'}
onChange={this.handleChange}
/>
</Form.Field>
<Form.Field>
<Radio
className='college-margin'
label='OS'
name='quota'
value='OS'
checked={quota === 'OS'}
onChange={this.handleChange}
/>
</Form.Field>
<Form.Field>
<Radio
className='college-margin'
label='Both'
name='quota'
value='All'
checked={quota === ''}
onChange={this.handleChange}
/>
</Form.Field>
</Form.Group>
</Form>
</div>
)}
</div>
<SemanticToastContainer />
</div>
<div className='year-note'>
To all the future JEE aspirants, Best of Luck! :))
</div>
</Segment>
<Accordion fluid styled>
<Accordion.Title
active={activeIndexs.includes(-1)}
index={-1}
onClick={this.handleAccordian}
>
<Icon name='dropdown' />
Instructions
</Accordion.Title>
<Accordion.Content active={activeIndexs.includes(-1)}>
<Message info list={instructions} />
</Accordion.Content>
<Accordion.Title
active={activeIndexs.includes(0)}
index={0}
onClick={this.handleAccordian}
>
<Icon name='dropdown' />
Primary Filters
</Accordion.Title>
<Accordion.Content active={activeIndexs.includes(0)}>
<div className={isBrowser ? 'secondary-filters' : null}>
<div className={isBrowser ? 'secondary-filters-col' : null}>
<div className='secondary-filters-margin'>
<Button content='Institute' color='facebook' />
<Dropdown
className='dropdown-filters'
name='institute_short'
value={institute_short}
placeholder='All'
selection
search
clearable
options={
this.state.institute_type === 'IIT'
? iitDropDownOptions
: nitDropDownOptions
}
onChange={this.handleChange}
/>
</div>
<div className='secondary-filters-margin'>
<Button content='Program' color='facebook' />
<Dropdown
className='dropdown-filters'
name='program'
value={program}
placeholder='All'
selection
search
clearable
options={
this.state.institute_type === 'IIT'
? iitProgramDropDownOptions
: nitProgramDropDownOptions
}
onChange={this.handleChange}
/>
</div>
</div>
<div className={isBrowser ? 'secondary-filters-col' : null}>
<div className='secondary-filters-margin'>
<Button content='Degree' color='facebook' />
<Dropdown
className='dropdown-filters'
name='degree'
value={degree}
placeholder='All'
selection
search
clearable
options={
this.state.institute_type === 'IIT'
? iitDegreeDropDownOptions
: nitDegreeDropDownOptions
}
onChange={this.handleChange}
/>
</div>
<div className='secondary-filters-margin'>
<Button content='Duration' color='facebook' />
<Dropdown
className='dropdown-filters'
name='duration'
value={duration}
placeholder='All'
selection
search
clearable
options={durationDropDownOptions}
onChange={this.handleChange}
/>
</div>
</div>
<div className={isBrowser ? 'secondary-filters-col' : null}>
<div className='secondary-filters-margin'>
<Button content='Pool' color='facebook' />
<Dropdown
className='dropdown-filters'
name='pool'
value={pool}
placeholder='All'
selection
search
clearable
options={poolDropDownOptions}
onChange={this.handleChange}
/>
</div>
<div className='secondary-filters-margin'>
<Button content='Category' color='facebook' />
<Dropdown
className='dropdown-filters'
name='category'
value={category}
placeholder='All'
selection
search
clearable
options={categoryDropDownOptions}
onChange={this.handleChange}
/>
</div>
</div>
</div>
</Accordion.Content>
<Accordion.Title
active={activeIndexs.includes(1)}
index={1}
onClick={this.handleAccordian}
>
<Icon name='dropdown' />
Personal Rank based search
</Accordion.Title>
<Accordion.Content active={activeIndexs.includes(1)}>
<div className='personalized-filter'>
<div className='personlized-filter-align'>
<Button
content={
institute_type === 'IIT' ? 'Adv. Rank' : 'Mains Rank'
}
color='blue'
/>
<Input
style={{ width: 130, height: 37 }}
type='number'
name='userrank'
value={userrank}
onChange={this.handlePersonalFilter}
placeholder='Enter your JEE Rank'
/>
</div>
<div className='personlized-filter-align'>
<Button content='Delta' color='blue' />
<Input
style={{ width: 130, height: 37 }}
type='number'
name='userdelta'
value={userdelta}
onChange={this.handlePersonalFilter}
placeholder='Enter prefered Delta'
/>
</div>
</div>
</Accordion.Content>
</Accordion>
<div className='reset-margin'>
<Button color='google plus' onClick={this.handleResetFilters}>
Reset Filters
</Button>
</div>
<div>
<div className='global-search'>
<Search
name='search'
value={search}
placeholder='Search by any keyword'
open={false}
fluid
onSearchChange={this.handleChange}
/>
</div>
</div>
<div className='table-overflow table-margin' id='scroll-ref'>
<Table celled color={'blue'} sortable unstackable>
<Table.Header>
<Table.Row>
<Table.HeaderCell textAlign='center'>Sr.</Table.HeaderCell>
<Table.HeaderCell textAlign='center'>Year</Table.HeaderCell>
{year === '2021' && (
<Table.HeaderCell textAlign='center'>Round</Table.HeaderCell>
)}
<Table.HeaderCell
sorted={
clickedColumn === 'institute_short' ? direction : null
}
onClick={this.handleSort('institute_short')}
textAlign='center'
>
Institute
</Table.HeaderCell>
<Table.HeaderCell
sorted={clickedColumn === 'program_name' ? direction : null}
onClick={this.handleSort('program_name')}
textAlign='center'
>
Program
</Table.HeaderCell>
{institute_type === 'NIT' && (
<Table.HeaderCell textAlign='center'>Quota</Table.HeaderCell>
)}
<Table.HeaderCell
sorted={
clickedColumn === 'program_duration' ? direction : null
}
onClick={this.handleSort('program_duration')}
textAlign='center'
>
Duration
</Table.HeaderCell>
<Table.HeaderCell
sorted={clickedColumn === 'degree_short' ? direction : null}
onClick={this.handleSort('degree_short')}
textAlign='center'
>
Degree
</Table.HeaderCell>
<Table.HeaderCell
sorted={clickedColumn === 'category' ? direction : null}
onClick={this.handleSort('category')}
textAlign='center'
>
Category
</Table.HeaderCell>
<Table.HeaderCell
sorted={clickedColumn === 'pool' ? direction : null}
onClick={this.handleSort('pool')}
textAlign='center'
>
Pool
</Table.HeaderCell>
<Table.HeaderCell
sorted={clickedColumn === 'opening_rank' ? direction : null}
onClick={this.handleSort('opening_rank')}
textAlign='center'
>
Opening
</Table.HeaderCell>
<Table.HeaderCell
sorted={clickedColumn === 'closing_rank' ? direction : null}
onClick={this.handleSort('closing_rank')}
textAlign='center'
>
Closing
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
{data.map(element => (
<Table.Row key={data.indexOf(element)}>
<Table.Cell collapsing textAlign='center'>
{data.indexOf(element) + 1 + 50 * (currPage - 1)}
</Table.Cell>
<Table.Cell collapsing textAlign='center'>
{element.year}
</Table.Cell>
{year === '2021' && (
<Table.Cell collapsing textAlign='center'>
{element.round_no}
</Table.Cell>
)}
<Table.Cell textAlign='center'>
{element.institute_short}
</Table.Cell>
<Table.Cell textAlign='center'>
{element.program_name}
</Table.Cell>
{institute_type === 'NIT' && (
<Table.Cell collapsing textAlign='center'>
{element.quota}
</Table.Cell>
)}
<Table.Cell collapsing textAlign='center'>
{element.program_duration}
</Table.Cell>
<Table.Cell textAlign='center'>
{element.degree_short}
</Table.Cell>
<Table.Cell collapsing textAlign='center'>
{element.category}
</Table.Cell>
<Table.Cell textAlign='center'>{element.pool}</Table.Cell>
<Table.Cell textAlign='center'>
{element.is_preparatory
? element.opening_rank + ' - P'
: element.opening_rank}
</Table.Cell>
<Table.Cell textAlign='center'>
{element.is_preparatory
? element.closing_rank + ' - P'
: element.closing_rank}
</Table.Cell>
</Table.Row>
))}
</Table.Body>
<Table.Footer>
<Table.Row>
<Table.HeaderCell colSpan='10'>
<Pagination
activePage={currPage}
totalPages={data ? Math.ceil(count / 50) : '1'}
onClick={() =>
document.getElementById('scroll-ref').scrollIntoView()
}
onPageChange={this.handlePageChange}
firstItem={{
'aria-label': 'First item',
content: <Icon name='angle double left' />,
key: '1'
}}
prevItem={{
'aria-label': 'Previous item',
content: <Icon name='angle left' />,
key: '4'
}}
nextItem={{
'aria-label': 'Next item',
content: <Icon name='angle right' />,
key: '3'
}}
lastItem={{
'aria-label': 'Last item',
content: <Icon name='angle double right' />,
key: '2'
}}
/>
</Table.HeaderCell>
</Table.Row>
</Table.Footer>
</Table>
<Icon
className='scroll-to-top'
name='chevron circle up'
size='big'
color='grey'
onClick={() => {
document.getElementById('scroll-to-filter').scrollIntoView()
}}
/>
</div>
<div className='github-repo'>
*This is an open source project, if found helpful, do star{' '}
<a
href='https://github.com/nisarg73/jee-dashboard'
target='_blank'
rel='noopener noreferrer'
>
its github repo
</a>{' '}
:D
</div>
</div>
)
}