-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added format and number of frames validation for time range component…
…s - MR
- Loading branch information
Showing
6 changed files
with
62 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ h1 { | |
|
||
#exportButton { | ||
margin-top: 1%; | ||
} | ||
} | ||
|
||
#deleteSlide1 { | ||
text-align:left; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
|
||
const validFormat = (range) => { | ||
const regex = /^[0-9]{2,2}:[0-9]{2,2}.[0-9]{2,2}/; | ||
return regex.test(range[0]) && regex.test(range[1]); | ||
} | ||
|
||
const validNumFrames = (range, numFrames) => { | ||
const startFrames = Number(range[0].split(".")[1]); | ||
const endFrames = Number(range[1].split(".")[1]); | ||
|
||
return ((startFrames >=1 && endFrames >= 1) && | ||
(startFrames <= numFrames && endFrames <= numFrames)); | ||
} | ||
|
||
export const validateRangeInput = (range, numFrames) => { | ||
if (validFormat(range) && validNumFrames(range, numFrames)) { | ||
return({display: "none"}); | ||
} | ||
return({display: "inline",color: "red"}); | ||
} |