@material-ui/core#FormControl JavaScript Examples
The following examples show how to use
@material-ui/core#FormControl.
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: CardMembers.js From TrelloClone with MIT License | 6 votes |
CardMembers = ({ card }) => {
const classes = useStyles();
const boardMembers = useSelector((state) => state.board.board.members);
const members = card.members.map((member) => member.user);
const dispatch = useDispatch();
return (
<div>
<h3 className={classes.membersTitle}>Members</h3>
<FormControl component='fieldset'>
<FormGroup>
{boardMembers.map((member) => (
<FormControlLabel
key={member.user}
control={
<Checkbox
checked={members.indexOf(member.user) !== -1}
onChange={async (e) =>
dispatch(
addCardMember({
add: e.target.checked,
cardId: card._id,
userId: e.target.name,
})
)
}
name={member.user}
/>
}
label={member.name}
/>
))}
</FormGroup>
</FormControl>
</div>
);
}
Example #2
Source File: Question.js From Quizzie with MIT License | 6 votes |
function Question(props) {
const [value, setValue] = React.useState('none');
const handleChange = (event) => {
setValue(event.target.value);
};
return (
<Grid item xs={10} md={8} lg={7} style={{margin: 0, padding: '2%', backgroundColor: '#111', borderBottom: '5px solid #222', minHeight: '50vh'}}>
<FormControl style={{margin: 'auto', width:"100%"}} component="fieldset">
<FormLabel className="label" component="legend">{props.id}</FormLabel>
<RadioGroup aria-label="correct-choice" value={value} onChange={handleChange}>
<FormControlLabel value="op1" control={<Radio className="radio" />} label="Option 1" style={{margin: 0}} />
<FormControlLabel value="op2" control={<Radio className="radio" />} label="Option 2" style={{margin: 0}} />
<FormControlLabel value="op3" control={<Radio className="radio" />} label="Option 3" style={{margin: 0}} />
<FormControlLabel value="op4" control={<Radio className="radio" />} label="Option 4" style={{margin: 0}} />
</RadioGroup>
</FormControl>
</Grid>
)
}
Example #3
Source File: examples.js From Queen with MIT License | 6 votes |
Examples = ({ selected, setSelected, className }) => {
const classes = useStyles();
const handleChange = event => {
setSelected(event.target.value);
};
return (
<FormControl className={`${classes.formControl} ${className}`}>
<InputLabel htmlFor="native-simple">{D.labelExample}</InputLabel>
<Select
native
value={selected}
onChange={handleChange}
inputProps={{
name: 'questionnaire',
id: 'native-simple',
}}
>
<option value="">{D.labelExamples}</option>
{QUESTIONNAIRE_EXAMPLES.map(v => {
return (
<option key={v} value={v}>
{v.toUpperCase()}
</option>
);
})}
</Select>
</FormControl>
);
}
Example #4
Source File: CountryPicker.jsx From ReactJS-Projects with MIT License | 6 votes |
Countries = ({ handleCountryChange }) => {
const [countries, setCountries] = useState([]);
useEffect(() => {
const fetchAPI = async () => {
setCountries(await fetchCountries());
};
fetchAPI();
}, []);
return (
<FormControl className={styles.formControl}>
<NativeSelect defaultValue="" onChange={(e) => handleCountryChange(e.target.value)}>
<option value="">United States</option>
{countries.map((country, i) => <option key={i} value={country}>{country}</option>)}
</NativeSelect>
</FormControl>
);
}
Example #5
Source File: SelectField.jsx From archeage-tools with The Unlicense | 6 votes |
render() {
const { id, label, value, renderValue, controlClassName } = this.props;
let { options } = this.props;
const entry = (key, value) => (
<MenuItem key={`${id}-${key}`} value={key}>{value}</MenuItem>
);
if (options instanceof Map) {
const opts = [];
options.forEach((value, key) => opts.push(entry(key, value)));
options = opts;
} else if (Array.isArray(options)) {
options = options.map(value => entry(value, value));
} else {
options = Object.entries(options).map(([key, value]) => entry(key, value));
}
return (
<FormControl className={controlClassName}>
{label &&
<InputLabel htmlFor={id}>{label}</InputLabel>}
<Select
value={value}
onChange={this.handleChange}
inputProps={{
name: id,
id,
}}
renderValue={renderValue}
>
{options}
</Select>
</FormControl>
);
}
Example #6
Source File: Select.js From web with GNU General Public License v3.0 | 6 votes |
Select = ({
changeHandler,
label,
name,
options,
required,
value,
white
}) => {
const renderOptions = options.map(option => (
<option key={option.value} value={option.value}>
{option.label}
</option>
));
const onChange = e => changeHandler(name, e.target.value);
return (
<SelectWrapper white={white}>
<FormControl required={required} variant="outlined">
{label && <Label required={required}>{label}</Label>}
<MuiSelect name={name} native onChange={onChange} value={value}>
{renderOptions}
</MuiSelect>
</FormControl>
</SelectWrapper>
);
}
Example #7
Source File: form-util.js From surveillance-forms with MIT License | 6 votes |
StatefulSelectField = ({ field }) => {
const { label, property, onChange, disabled, choices } = field;
const [value, setValue] = useState("");
const handleChange = (event) => {
const newValue = event.target.value;
setValue(newValue);
if (onChange) {
onChange(newValue);
}
};
return (
<Box>
<InputLabel shrink>{label}</InputLabel>
<FormControl
style={{
width: "100%",
}}
variant="outlined"
size="small"
>
<Select
labelId={`label-${property}`}
id={`select-${property}`}
value={value}
disabled={!!disabled}
onChange={handleChange}
>
{choices.map((c, index) => (
<MenuItem key={index} value={c.value}>
{c.label}
</MenuItem>
))}
</Select>
</FormControl>
</Box>
);
}
Example #8
Source File: SortMenu.js From to-view-list with MIT License | 6 votes |
SortMenu = () => {
const [{ sortBy }, dispatch] = useEntryContext();
const classes = useSortStyles();
const handleSelectChange = (e) => {
dispatch(sortEntries(e.target.value));
};
return (
<div className={classes.root}>
<Typography variant="subtitle1" className={classes.label}>
<SortIcon className={classes.sortIcon} />
Sort by:
</Typography>
<form>
<FormControl>
<Select
value={sortBy}
displayEmpty
onChange={handleSelectChange}
className={classes.select}
>
<MenuItem value="newest">Newest first</MenuItem>
<MenuItem value="oldest">Oldest first</MenuItem>
<MenuItem value="a-z">Title: A - Z</MenuItem>
<MenuItem value="z-a">Title: Z - A</MenuItem>
</Select>
</FormControl>
</form>
</div>
);
}
Example #9
Source File: AddGraph.js From Interceptor with MIT License | 6 votes |
render() {
//console.log("Rendering AddGraph");
return (
<Dialog
open={this.props.show}
aria-labelledby="form-dialog-title"
>
<DialogTitle id="form-dialog-title">Add Graph</DialogTitle>
<DialogContent>
<Grid container spacing={2} direction="column" alignItems="center">
<Grid item>
<FormControl>
<InputLabel htmlFor="plotname">Plot Name</InputLabel>
<Input
id="plotname"
onChange={event => this.plotname = event.target.value}
aria-describedby="plotname-helper-text"
inputProps={{
'aria-label': 'Plot Name',
}}
/>
<FormHelperText id="plotname-helper-text">Can be left empty</FormHelperText>
</FormControl>
</Grid>
<Grid item>
<ToggleButtonGroup orientation="vertical" value={this.lines} onChange={(event, lines) => {this.lines = lines; this.setState({render_revision: this.state.render_revision + 1}); } } aria-label="lines available">
{this.renderButtons()}
</ToggleButtonGroup>
</Grid>
</Grid>
</DialogContent>
<DialogActions>
<Button onClick={() => this.props.addplot(this.plotname, this.lines)} color="default">
Save
</Button>
</DialogActions>
</Dialog>
);
}
Example #10
Source File: index.js From Edlib with GNU General Public License v3.0 | 6 votes |
render() {
const { classes } = this.props;
return (
<div className="adapterSelector">
<FormControl
className={classes.formControl}
>
<NativeSelect
value={this.props.current}
onChange={event => this.handleChange(event.target.value)}
name="adapterMode"
className={classes.nativeSelect}
>
{this.props.adapters.map(data => (<option key={data.key} value={data.key}>{data.name}</option>))}
</NativeSelect>
</FormControl>
</div>
);
}
Example #11
Source File: tagSelector.js From graphql-sample-apps with Apache License 2.0 | 6 votes |
export default function TagSelector({names, tags, handleChange}){
const classes = useStyles();
const theme = useTheme();
return (
<FormControl className={classes.formControl}>
<InputLabel id="demo-mutiple-chip-label" >Tags</InputLabel>
<Select
labelId="demo-mutiple-chip-label"
id="demo-mutiple-chip"
multiple
value={tags}
onChange={handleChange}
input={<Input id="select-multiple-chip" />}
renderValue={(selected) => (
<div className={classes.chips}>
{selected.map((value) => (
<Chip key={value} label={value} className={classes.chip} />
))}
</div>
)}
MenuProps={MenuProps}
>
{names.map((name) => (
<MenuItem key={name} value={name} style={getStyles(name, tags, theme)}>
{name}
</MenuItem>
))}
</Select>
</FormControl>
)
}
Example #12
Source File: CountryPicker (2).jsx From CovidIndiaStats with MIT License | 6 votes |
CountryPicker = ({ handleCountryChange }) => {
const [fetchedCountries, setFetchedCountries] = useState([]);
useEffect(() => {
const fetchAPI = async () => {
setFetchedCountries(await countries());
};
fetchAPI();
}, [setFetchedCountries]);
if (fetchedCountries) {
return (
<FormControl
className={`${styles.formControl} fadeInUp`}
style={{ animationDelay: "1s" }}
>
<NativeSelect
defaultValue=""
onChange={(e) => handleCountryChange(e.target.value)}
onClick={ReactGa.event({
category: "Global options",
action: "Global options checked",
})}
>
<option value="Global">Global</option>
{fetchedCountries.map((item, i) => (
<option value={item.country} key={i}>
{item.country}
</option>
))}
</NativeSelect>
</FormControl>
);
} else return null;
}
Example #13
Source File: index.js From AED-Map with MIT License | 6 votes |
MySelect = ({
label,
labelTitle,
options,
variant,
classes,
...props
}) => {
const [field] = useField(props);
const inputLabel = useRef(null);
const [labelWidth, setLabelWidth] = useState(0);
useEffect(() => {
setLabelWidth(inputLabel.current.offsetWidth);
}, []);
return (
<FormControl className={classes} variant={variant}>
<InputLabel id={label} ref={inputLabel}>
{labelTitle}
</InputLabel>
<Select
labelId={label}
labelWidth={labelWidth}
{...field}
{...props}
>
{options.map(option => (
<MenuItem key={option} value={option}>
{option || <em>всі</em>}
</MenuItem>
))}
</Select>
</FormControl>
);
}
Example #14
Source File: nav-sort.js From horondi_admin with MIT License | 6 votes |
NavSort = ({ sortOptions }) => {
const styles = useStyles();
const { setSorting, sortLabel: sortLabelValue } = sortOptions;
const selectOptions = _.map(sortOptions.labels, ({ label, value }) => (
<MenuItem key={label} value={value}>
{label}
</MenuItem>
));
const { optionHandler } = useSort(sortOptions.labels, setSorting);
return (
<div className={styles.sort}>
<FormControl className={styles.formControl}>
<InputLabel id={materialUiConstants.checkBoxLabel}>
{sortLabel}
</InputLabel>
<Select
data-cy='user-sorting'
labelId='checkbox-label'
id='checkbox'
value={sortLabelValue}
onChange={optionHandler}
defaultValue={0}
>
{selectOptions}
</Select>
</FormControl>
</div>
);
}
Example #15
Source File: SettingsPage.js From Doto with MIT License | 6 votes |
InputNameField = props => {
return (
<FormControl id="input-field">
<Input
startAdornment={
<InputAdornment position="start">
<AccountCircle />
</InputAdornment>
}
value={props.name}
disabled={true}
/>
</FormControl>
);
}
Example #16
Source File: AudioInputList.js From symbl-twilio-video-react with Apache License 2.0 | 6 votes |
export default function AudioInputList() {
const classes = useStyles();
const audioInputDevices = useAudioInputDevices();
const { localTracks } = useVideoContext();
const localAudioTrack = localTracks.find(track => track.kind === 'audio');
const mediaStreamTrack = useMediaStreamTrack(localAudioTrack);
const localAudioInputDeviceId = mediaStreamTrack ? mediaStreamTrack.getSettings().deviceId : undefined;
function replaceTrack(newDeviceId) {
localAudioTrack && localAudioTrack.restart({ deviceId: { exact: newDeviceId } });
}
return (
<div className={classes.container}>
<div className="inputSelect">
{audioInputDevices.length > 1 ? (
<FormControl fullWidth>
<Typography variant="h6">Audio Input:</Typography>
<Select onChange={e => replaceTrack(e.target.value)} value={localAudioInputDeviceId || ''}>
{audioInputDevices.map(device => (
<MenuItem value={device.deviceId} key={device.deviceId}>
{device.label}
</MenuItem>
))}
</Select>
</FormControl>
) : (
<>
<Typography variant="h6">Audio Input:</Typography>
<Typography>{localAudioTrack && localAudioTrack.mediaStreamTrack.label || 'No Local Audio'}</Typography>
</>
)}
</div>
<LocalAudioLevelIndicator />
</div>
);
}
Example #17
Source File: CountryPicker.jsx From javascript-mini-projects with The Unlicense | 6 votes |
CountryPicker = ({ handleCountryChange }) => {
const [fetchedCountries, setFetchedCountries]= useState([]);
useEffect(() => {
const fetchAPI = async () => {
setFetchedCountries(await fetchCountries());
}
fetchAPI();
}, [setFetchedCountries]);
console.log(fetchedCountries);
return(
<FormControl className={styles.formControl}>
<NativeSelect defaultValue="" onChange={(e) => handleCountryChange (e.target.value)}>
<option value="">Global</option>
{fetchedCountries.map((country, i) => <option key={i} value={country}>{country}</option>)}
</NativeSelect>
</FormControl>
)
}
Example #18
Source File: footer.jsx From ileverage-finance with MIT License | 6 votes |
render() {
const { classes, t, location } = this.props;
const {
languages,
language
} = this.state
if(!location.pathname.includes('/open') && !location.pathname.includes('/close')) {
return null
}
return (
<div className={classes.footer}>
<div className={classes.footerLinks}>
<Link to={"/"} className={ classes.link }>
<Typography className={ classes.footerText } variant={ 'h6'}>{ t('Footer.Home') }</Typography>
</Link>
</div>
<div className={ classes.languageContainer }>
<FormControl variant="outlined">
<Select
id="language"
value={ language }
onChange={ this.handleLanguageChange }
inputProps={{ className: classes.selectInput }}
color="primary"
fullWidth
>
{ languages.map((language) => {
return <MenuItem key={ language.code } value={ language.code }>{ language.language }</MenuItem>
})}
</Select>
</FormControl>
</div>
</div>
)
}
Example #19
Source File: footer.jsx From iliquidate-finance with MIT License | 6 votes |
render() {
const { classes, t, location } = this.props;
const {
languages,
language
} = this.state
if(!location.pathname.includes('/liquidate') && !location.pathname.includes('/liquidationCandidates')) {
return null
}
return (
<div className={classes.footer}>
<div className={classes.footerLinks}>
<Link to={"/"} className={ classes.link }>
<Typography className={ classes.footerText } variant={ 'h6'}>{ t('Footer.Home') }</Typography>
</Link>
</div>
<div className={ classes.languageContainer }>
<FormControl variant="outlined">
<Select
id="language"
value={ language }
onChange={ this.handleLanguageChange }
inputProps={{ className: classes.selectInput }}
color="primary"
fullWidth
>
{ languages.map((language) => {
return <MenuItem key={ language.code } value={ language.code }>{ language.language }</MenuItem>
})}
</Select>
</FormControl>
</div>
</div>
)
}
Example #20
Source File: DeploymentNameModal.js From akashlytics-deploy with GNU General Public License v3.0 | 5 votes |
DeploymentNameModal = ({ dseq, onClose, onSaved, getDeploymentName }) => {
const classes = useStyles();
const formRef = useRef();
const { enqueueSnackbar } = useSnackbar();
const { handleSubmit, control, setValue } = useForm({
defaultValues: {
name: ""
}
});
useEffect(() => {
if (dseq) {
const name = getDeploymentName(dseq);
setValue("name", name || "");
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [dseq, getDeploymentName]);
const onSaveClick = (event) => {
event.preventDefault();
formRef.current.dispatchEvent(new Event("submit", { cancelable: true, bubbles: true }));
};
function onSubmit({ name }) {
updateDeploymentLocalData(dseq, { name: name });
enqueueSnackbar(<Snackbar title="Success!" iconVariant="success" />, { variant: "success", autoHideDuration: 1000 });
onSaved();
}
return (
<Dialog open={!!dseq} onClose={onClose} maxWidth="xs" fullWidth>
<DialogTitle>Change Deployment Name {dseq ? `(${dseq})` : ""}</DialogTitle>
<DialogContent dividers className={classes.dialogContent}>
<form onSubmit={handleSubmit(onSubmit)} ref={formRef}>
<FormControl fullWidth>
<Controller
control={control}
name="name"
render={({ field }) => {
return <TextField {...field} autoFocus type="text" variant="outlined" label="Name" />;
}}
/>
</FormControl>
</form>
</DialogContent>
<DialogActions className={classes.dialogActions}>
<Button onClick={onClose}>Close</Button>
<Button variant="contained" color="primary" onClick={onSaveClick}>
Save
</Button>
</DialogActions>
</Dialog>
);
}
Example #21
Source File: LeftPanel.js From usfm-grammar-online with MIT License | 5 votes |
LeftPanel = (props) => {
const { usfmValue, setUsfmValue, mode, setMode } = useContext(GrammarContext);
const handleTextChange = (event) => {
setUsfmValue(event.target.value);
};
const handleChange = (event) => {
setMode(event.target.value);
};
return (
<>
<AppBar position="static" color="default">
<Toolbar>
<Box flexGrow={1} display="flex">
<Link href="https://github.com/ubsicap/usfm" target="_blank">
<Typography
style={{
marginRight: 20,
color: "black",
}}
variant="h6"
>
USFM
</Typography>
</Link>
<FormControl variant="outlined" style={{ width: 106 }}>
<InputLabel id="demo-simple-select-outlined-label">
Mode
</InputLabel>
<Select
style={{ height: 37 }}
labelId="demo-simple-select-outlined-label"
id="demo-simple-select-outlined"
value={mode}
onChange={handleChange}
label="Mode"
>
<MenuItem value="regular">Regular</MenuItem>
<MenuItem value="relaxed">Relaxed</MenuItem>
</Select>
</FormControl>
<ParseUsfm />
</Box>
<Upload setValue={setUsfmValue} type="usfm" />
<Download extension="usfm" />
</Toolbar>
</AppBar>
<CssTextField
id="usfmText"
placeholder="Enter/Upload USFM Text"
onChange={handleTextChange}
value={usfmValue}
/>
</>
);
}
Example #22
Source File: OperationForm.js From Designer-Client with GNU General Public License v3.0 | 5 votes |
export default function OperationForm(props) {
const classes = useStyles();
const operation = props.operation;
return (
<div className={classes.formContainer}>
<div className={classes.formGroup}>
<FormControl fullWidth={true}>
<InputLabel htmlFor="operation-title">오퍼레이션 명칭</InputLabel>
<Input id="operation-title" value={operation.title}></Input>
</FormControl>
</div>
<div className={classes.formGroup}>
<FormControl fullWidth={true}>
<TextField
id="operation-description"
label="오퍼레이션 설명"
multiline
rows={5}
value={operation.desc}
aria-describedby="description-helper-text"
name="description"
placeholder="API 이용자에게 안내되는 설명글 입니다. 데이터의 이해를 위한 설명을 친절히 작성해 주세요."
/>
</FormControl>
</div>
<div className={classes.formGroup}>
<Grid container spacing={2}>
<Grid item xs={12} sm={3}>
<FormControl fullWidth={true}>
<InputLabel width="100%" htmlFor="operation-method">
호출 방식
</InputLabel>
<Select
labelId="operation-method"
id="namespace-input"
name="method"
value={operation.method || 'GET'}
>
<MenuItem value={"GET"}>GET</MenuItem>
</Select>
<FormHelperText id="operation-method-text">Http metod를 선택해주세요. 현재 GET 기능만 지원합니다.</FormHelperText>
</FormControl>
</Grid>
<Grid item xs={12} sm={9}>
<FormControl fullWidth={true}>
<InputLabel width="100%" htmlFor="operation-end-point">호출 주소</InputLabel>
<Input id="operation-end-point" value={operation.endPoint || ''} aria-describedby="entityName-helper-text" name="entityName" />
<FormHelperText id="operation-end-point-text">{`https://OOOOOO.go.kr/api/APINAME/v1/TEST`}</FormHelperText>
</FormControl>
</Grid>
</Grid>
</div>
</div>
)
}
Example #23
Source File: ActivitiesDataModule.js From ehr with GNU Affero General Public License v3.0 | 5 votes |
render() {
const { loading, filters } = this.state;
return (
<div style={{ height: '100%', display: 'flex', flexDirection: 'column' }}>
<div>
<div className="title">
<Typography variant="h3">{t('ehr', 'Activities')}</Typography>
</div>
<Box className="add-new" mt={2}>
<KailonaButton title={t('ehr', 'Add New Activity')} onClick={this.onAddNewActivities} />
</Box>
<Box className="filters" mt={2}>
<Grid container alignItems="center" justifyContent="center">
<Grid item>
<Typography variant="body1" style={{ marginRight: '6px' }}>
{t('ehr', 'Filter by')}:{' '}
</Typography>
</Grid>
<Grid className="right-column" item>
<FormControl>
<KailonaDateRangePicker
id="date"
defaultValue={filters.dateRange}
onChange={this.filterByDateRange}
ariaLabel={t('ehr', 'Filter by date')}
maxDate={new Date()}
/>
</FormControl>
</Grid>
</Grid>
</Box>
</div>
<Box className="content" mt={3} style={{ display: 'flex', flex: 1 }}>
<KailonaTable
data={this.state.data}
columns={this.state.columns}
page={this.state.page}
rowsPerPage={this.state.rowsPerPage}
onChangePage={this.onChangePage}
onChangeRowsPerPage={this.onChangeRowsPerPage}
contextMenu={this.contextMenuOptions}
onEdit={this.onEditActivities}
loading={loading}
fetchNewData={this.fetchNextActivities}
/>
</Box>
<ActivitiesEditModal
ref={this.activitiesEditModalRef}
activitiesData={this.state.activitiesDataToUpdate}
handleSave={this.handleSave}
savingActivities={this.state.savingActivities}
/>
</div>
);
}
Example #24
Source File: header.js From ark-funds-monitor with GNU Affero General Public License v3.0 | 5 votes |
render() {
return (
<div className="header-section">
<Grid container spacing={3} justify="center" alignItems="center">
<Grid item xs={6} md={10} className='title-container'>
{/* <span className="logo">
<a href="http://karlzhu-se.github.io/ark-funds-monitor/">
<img height="90" width="120" src="https://ark-funds.com/wp-content/uploads/2020/07/ark-logo-1-1.svg" alt="ark-funds.com" title="" />
</a>
</span> */}
<a className='title' href="http://karlzhu-se.github.io/ark-funds-monitor/">
<span>ARK Funds Monitor</span>
</a>
{/* <div className="github-section">
<span>View it on</span>
<a className="github-icon" href="https://github.com/KarlZhu-SE/ark-funds-monitor" target="_blank" rel="noopener noreferrer" aria-label="Github">
<svg height="24" viewBox="0 0 16 16" version="1.1" width="24" aria-hidden="true"><path fillRule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>
</a>
</div> */}
</Grid>
<Grid item xs={6} md={2} className="ticker-input-section">
<form onSubmit={this.handleSubmit}>
<FormControl>
<div>
<Input
id="ticker-textfield"
value={this.state.inputTicker}
onCompositionStart={this.handlingComposition}
onCompositionUpdate={this.handlingComposition}
onCompositionEnd={this.handleComposition}
onChange={this.handleChange}
onBlur={this.handleBlur}
placeholder='Ticker'
endAdornment={
<InputAdornment position="start">
<IconButton
aria-label="Search"
onClick={this.handleSubmit}
edge="end"
>
<SearchIcon color="primary" />
</IconButton>
</InputAdornment>
}
/>
</div>
</FormControl>
</form>
</Grid>
</Grid>
</div>
);
}
Example #25
Source File: LinRegToolbox.js From Otto with MIT License | 5 votes |
export default function LinRegToolbox() {
const classes = useStyles();
const { state } = useState();
const { model_state, model_dispatch } = useModelState();
const [indVar, setIndVar] = React.useState(model_state.linreg_x_name);
React.useEffect(() => {
setIndVar(model_state.linreg_x_name);
}, [model_state.linreg_x_name]);
function shouldRetrain() {
return model_state.linreg_x_name !== indVar;
}
function onUpdatePlot() {
model_dispatch({
type: ModelActions.LINREG_SET_IND_VAR,
linreg_x_name: indVar,
});
invokeLinReg(model_dispatch, state.sample_dataset, indVar, false);
}
return (
<Card style={{ border: "none", boxShadow: "none" }}>
<Grid direction="column" container>
{/* Column 1 */}
<Grid item className={classes.actionItem}>
<FormControl className={classes.actionWidth}>
<InputLabel id="demo-simple-select-label">
Independent Variable
</InputLabel>
<Select
value={indVar !== "" ? indVar : ""}
onChange={(event) => setIndVar(event.target.value)}
>
{model_state.linreg_columns.map((column, index) => (
<MenuItem key={index} value={column}>
{column}
</MenuItem>
))}
</Select>
</FormControl>
</Grid>
<Grid item>
<Button
color="primary"
className={classes.button}
variant="outlined"
onClick={onUpdatePlot}
disabled={!shouldRetrain()}
>
{"Re-Train Model"}
</Button>
</Grid>
</Grid>
</Card>
);
}
Example #26
Source File: Login.jsx From archeage-tools with The Unlicense | 5 votes |
render() {
const { open, closeWindow } = this.props;
const { formData, loading } = this.state;
return (
<Dialog
open={open}
onClose={closeWindow}
maxWidth="xl"
>
<AppBar position="static">
<Toolbar variant="dense">
<Typography variant="subtitle1" className="title-text">Login</Typography>
<IconButton color="inherit" aria-label="Close" onClick={closeWindow}>
<CloseIcon />
</IconButton>
</Toolbar>
</AppBar>
<DialogContent>
<form autoComplete="off" onSubmit={this.handleSubmit}>
<FormControl component="fieldset" className="form-control">
<TextField
id="login-username"
required
label="Username"
value={formData.username}
onChange={this.handleChange('username')}
/>
<TextField
id="login-password"
required
label="Password"
value={formData.password}
onChange={this.handleChange('password')}
type="password"
/>
<Button
variant="contained"
color="primary"
type="submit"
className="submit"
disabled={loading}
>
Login
</Button>
</FormControl>
</form>
</DialogContent>
</Dialog>
);
}
Example #27
Source File: CreateNewBudget.js From Simplify-Testing-with-React-Testing-Library with MIT License | 5 votes |
render() {
const { classes } = this.props;
const { open, category, amount } = this.state;
return (
<Fragment>
<Button
variant='contained'
className={classes.newBudgetBtn}
color='primary'
onClick={this.handleOpen}
>
Create New Budget
</Button>
<Modal
aria-labelledby='Create New Budget'
aria-describedby="Create's a new budget"
open={open}
onClose={this.handleClose}
>
<div className={classes.paper}>
<Typography variant='body1' id='modal-title'>
Select a category and enter a budget amount.
</Typography>
<FormControl
style={{
width: '181px',
marginTop: '10px',
marginBottom: '20px',
}}
>
<InputLabel htmlFor='category-native-simple'>Category</InputLabel>
<Select
native
value={category}
onChange={this.handleChange}
inputProps={{
name: 'category',
id: 'category-native-simple',
}}
>
<option value='' />
{this.renderBudgetOptions()}
</Select>
</FormControl>
<FormControl style={{ display: 'block', marginBottom: '20px' }}>
<InputLabel htmlFor='adornment-amount'>Amount</InputLabel>
<Input
type='number'
inputProps={{
name: 'amount',
id: 'amount-native-simple',
}}
placeholder='Enter a number'
onChange={this.handleChange}
startAdornment={
<InputAdornment position='start'>$</InputAdornment>
}
/>
<Typography color='error' variant='body1'>
* Budgets must be in increments of 5. {<br />}* Amounts less
than 5 will default to $5.
</Typography>
</FormControl>
<Button
disabled={amount && category ? false : true}
fullWidth
variant='contained'
color='secondary'
onClick={this.handleAddNewBudget}
>
Add Budget
</Button>
</div>
</Modal>
</Fragment>
);
}
Example #28
Source File: Header.js From surveillance-forms with MIT License | 5 votes |
Header = ({ user, onLanguageSelect, lang, langCode, classes }) => {
const handleLanguageChange = (e) => {
onLanguageSelect(e.target.value);
};
const renderLanguageSelector = () => {
const supportedLanguages = langUtil.getSupportedLanguages(lang);
return (
<div>
<InputLabel shrink>Language:</InputLabel>
<FormControl
style={{
width: "100%",
}}
size="small"
>
<Select value={langCode} onChange={handleLanguageChange}>
{supportedLanguages.map((s, index) => (
<MenuItem key={index} value={s.value}>
<Typography>{s.label}</Typography>
</MenuItem>
))}
</Select>
</FormControl>
</div>
);
};
// <img src="/Flag.png" style={{ verticalAlign: 'middle', marginRight: 10 }} alt="flag"/>
return (
<AppBar
position="static"
style={{
color: "white",
backgroundColor: "#0040B7",
justifyContent: "middle",
}}
>
<Toolbar variant="dense">
<Typography variant="h6" style={{ flexGrow: 1 }}>
{lang.t("headerTitle")}
</Typography>
{renderLanguageSelector()}
</Toolbar>
</AppBar>
);
}
Example #29
Source File: FeaturedPost.js From alexa-community-jaipur with MIT License | 5 votes |
export default function FeaturedPost(props) {
const classes = useStyles();
const { post } = props;
return (
<Grid item xs={12} md={6}>
<Card className={classes.card}>
<div className={classes.cardDetails}>
<CardContent>
<Typography component="h2" variant="h5">
{post.title}
</Typography>
<Typography variant="subtitle1" color="textSecondary">
{post.date}
</Typography>
<Typography variant="subtitle1" paragraph>
{post.description}
</Typography>
{post.suggestionPlaceholder ? (
<Grid container direction="row">
<FormControl>
<Grid item>
<InputLabel htmlFor="suggestions">
{post.suggestionPlaceholder}
</InputLabel>
<Input
id="suggestions"
aria-describedby="my-helper-suggestions"
/>
<Button type="submit">Submit</Button>
</Grid>
<FormHelperText id="my-helper-suggestions">
We will try to cover the most asked topics.
</FormHelperText>
</FormControl>
</Grid>
) : null}
{post.feedback ? (
<Grid container direction="row">
<FormControl>
<Grid item>
<InputLabel htmlFor="feedback">{post.feedback}</InputLabel>
<Input id="feedback" aria-describedby="my-helper-text" />
<Button type="submit">Submit</Button>
</Grid>
<FormHelperText id="my-helper-text">
Your feedback helps us improve.
</FormHelperText>
</FormControl>
</Grid>
) : null}
<Typography variant="subtitle1" color="primary">
<Button href="#" disabled={post.buttonDisable}>
{post.buttonText}
</Button>
</Typography>
</CardContent>
</div>
<Hidden xsDown>
<CardMedia
className={classes.cardMedia}
image={post.image}
title={post.imageTitle}
/>
</Hidden>
</Card>
</Grid>
);
}