@material-ui/icons APIs
- ExpandMore
- Delete
- Close
- Visibility
- VisibilityOff
- Check
- Add
- Edit
- Search
- ExpandLess
- Settings
- Person
- Info
- Clear
- ExitToApp
- ArrowDropDown
- Home
- GitHub
- Warning
- ArrowBack
- SearchOutlined
- Done
- LocationOn
- PlayArrow
- Apps
- Brightness4
- Brightness7
- Description
- KeyboardArrowDown
- KeyboardArrowLeft
- KeyboardArrowRight
- MoreVert
- LocationCity
- Map
- Image
- AccountCircle
- InfoOutlined
- Create
- Block
- Replay
- AddCircle
- HomeRounded
- GetApp
- ChevronLeft
- ChevronRight
- CloudDownload
- CheckCircleOutline
- Send
- LockOpen
- Cancel
- NavigateNext
- AccountBox
- DragIndicator
- FavoriteBorderOutlined
- AccessTime
- DoneAll
- CheckCircle
- CropFree
- LockOutlined
- Undo
- Dashboard
- People
- PhotoLibrary
- HomeOutlined
- Group
- ArrowDropUp
- Remove
- ArrowUpward
- Save
- ArrowForward
- AttachFile
- Headset
- SignalCellularAlt
- ArrowForwardIos
- PlayCircleFilled
- AccessAlarm
- Adjust
- BarChart
- CloseRounded
- PlayArrowOutlined
- ImageRounded
- MenuBookRounded
- RefreshRounded
- HourglassEmptyOutlined
- Announcement
- Ballot
- QuestionAnswerOutlined
- CloudUpload
- SkipNext
- ArrowRightAlt
- MoreHoriz
- FileCopy
- MenuBook
- Language
- AlternateEmail
- FolderOpen
- Lock
- Pets
- AddCircleRounded
- ExploreRounded
- WbSunnyRounded
- Brightness2Rounded
- DonutLargeRounded
- AssistantRounded
- AccountCircleRounded
- ExitToAppRounded
- VpnKey
- MailOutline
- Smartphone
- DeleteForever
- LanguageOutlined
- Colorize
- SignalCellularConnectedNoInternet2Bar
- SignalCellularConnectedNoInternet0Bar
- SignalCellular4Bar
- DeleteOutline
- NewReleases
- LocalOffer
- Assessment
- Place
- TrendingDown
- ShoppingCart
- Stop
- RotateLeft
- Menu
- Flag
- Forum
- GroupSharp
- InsertEmoticon
- NotificationsActive
- PhoneIphone
- AllInbox
- Comment
- Photo
- PlaylistAddCheck
- CloudUploadRounded
- ExpandMoreOutlined
- History
- PersonOutlineOutlined
- ArrowForwardIosRounded
- ArrowBackIosRounded
- AssignmentOutlined
- VerticalAlignCenterOutlined
- CalendarTodayOutlined
- Error
- PlaylistPlay
- MusicNoteTwoTone
- Portrait
- ExploreOutlined
- DeleteRounded
- EditRounded
- SaveRounded
- CreateNewFolder
- MeetingRoom
- MenuOpenRounded
- MenuRounded
- DateRange
- CallEnd
- Assignment
- KeyboardBackspace
- BluetoothSearching
- CameraAlt
- PlaylistAdd
- Favorite
- Bluetooth
- OpenInBrowser
- Loop
- FileCopyOutlined
- NavigateBefore
- MergeType
- Dvr
- PersonOutline
- PlayCircleFilledWhiteOutlined
- StoreMallDirectoryOutlined
- SupervisedUserCircleOutlined
- MonetizationOn
- OpenInNew
- ArrowDownward
- AddBox
- FilterList
- FirstPage
- LastPage
- ViewColumn
- Notifications
- DriveEta
- LocalTaxi
- Redo
- AccountTree
- TextFields
- SaveAlt
- ThumbDown
- ThumbUp
- LocalPhone
- VolumeUp
- VolumeDown
- Translate
- AddCircleOutlined
- RemoveCircleOutlined
- Router
- RemoveRedEye
- Chat
- Mood
- Mic
OtherRelated APIs
- react#useState
- react#useEffect
- @material-ui/core#Typography
- @material-ui/core#Button
- @material-ui/core#Container
- @material-ui/core#MenuItem
- @material-ui/core#Grid
- @material-ui/core#Select
- @material-ui/core#InputLabel
- @material-ui/core#Snackbar
- @material-ui/core#Slider
- react-router#Redirect
- @material-ui/lab#Alert
- @material-ui/pickers#MuiPickersUtilsProvider
- @material-ui/pickers#KeyboardDatePicker
- @material-ui/pickers#KeyboardTimePicker
@material-ui/icons#AccessAlarm JavaScript Examples
The following examples show how to use
@material-ui/icons#AccessAlarm.
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: CreateQuiz.js From Quizzie with MIT License | 4 votes |
function CreateQuiz() {
const [quizName, setQuizName] = useState("");
const [quizDate, setQuizDate] = useState(new Date());
const [duration, setDuration] = useState(5);
const [type, setType] = useState("private");
const [loading, setLoading] = useState(false);
const [redirect, setRedirect] = useState(false);
const [redirectEdit, setRedirectEdit] = useState(false);
const [quizId, setQuizId] = useState("");
const [error, setError] = useState(false);
const { executeRecaptcha } = useGoogleReCaptcha();
const onQuizNameChange = (event) => {
setQuizName(event.target.value);
};
const handleDateChange = (date) => {
setQuizDate(date);
};
const handleTimeChange = (e, val) => {
setDuration(val);
};
const onTypeChange = (event) => {
setType(event.target.value);
};
const handleSubmit = async () => {
setLoading(true);
let token = localStorage.getItem("authToken");
let url = "https://quizzie-api.herokuapp.com/quiz/createQuiz";
let captcha = await executeRecaptcha("create_quiz");
let data = {
quizName: quizName,
scheduledFor: quizDate.getTime(),
quizDuration: duration,
quizType: type,
captcha: captcha,
};
try {
await axios
.post(url, data, {
headers: {
"auth-token": token,
},
})
.then((res) => {
setQuizId(res.data.result._id);
setLoading(false);
setRedirectEdit(true);
});
} catch (error) {
console.log(error);
setLoading(false);
}
};
useEffect(() => {
let token = localStorage.getItem("authToken");
if (token === null) {
setLoading(false);
setRedirect(true);
return;
}
}, []);
if (loading) {
return <Loading />;
} else if (redirect) {
return <Redirect to="/dashboard" />;
} else if (redirectEdit) {
return <Redirect to={`/editQuiz/${quizId}`} />;
} else {
return (
<Container className="create-quiz-page">
<div className="create-form">
<Typography variant="h4" className="create-head">
Quiz Details
</Typography>
<div className="create-form-inputs">
<TextInput
variant="outlined"
label="Quiz Name"
value={quizName}
onChange={onQuizNameChange}
name="Quiz Name"
className="form-input"
/>
<MuiPickersUtilsProvider utils={DateFnsUtils}>
<Grid
className="date-time-select"
container
spacing={3}
>
<Grid item xs={12} sm={6}>
<KeyboardDatePicker
disableToolbar
variant="inline"
format="MM/dd/yyyy"
margin="normal"
label="Select Quiz Date"
value={quizDate}
onChange={handleDateChange}
/>
</Grid>
<Grid item xs={12} sm={6}>
<KeyboardTimePicker
ampm={true}
format="hh:mm:ss aa"
views={["hours", "minutes", "seconds"]}
margin="normal"
label="Select Quiz Start Time"
value={quizDate}
onChange={handleDateChange}
keyboardIcon={<AccessAlarm />}
/>
</Grid>
</Grid>
</MuiPickersUtilsProvider>
<p style={{ marginTop: "5%", marginBottom: "5%" }}>
Quiz Time (in minutes):
</p>
<Slider
defaultValue={5}
aria-labelledby="quiz time slider"
step={5}
min={5}
max={60}
valueLabelDisplay="on"
marks
className="time-slider"
value={duration}
onChange={handleTimeChange}
/>
<p>Select quiz type: </p>
<Select
value={type}
onChange={onTypeChange}
className="type-select"
>
<MenuItem value="public">Public</MenuItem>
<MenuItem value="private">Private</MenuItem>
</Select>
<Button
className="login-btn create-btn"
onClick={handleSubmit}
>
Create Quiz
</Button>
<Typography
variant="subtitle1"
className="create-subtitle"
>
NOTE: After creating the quiz, you can add questions
by editing the quiz in YOUR QUIZZES section of the
dashboard.
</Typography>
</div>
</div>
<Snackbar
open={error}
autoHideDuration={5000}
onClose={() => setError(false)}
>
<Alert
variant="filled"
severity="error"
onClose={() => setError(false)}
>
There was a problem. Please try again!
</Alert>
</Snackbar>
</Container>
);
}
}