itizawa před 5 roky
rodič
revize
e0205cca01
1 změnil soubory, kde provedl 19 přidání a 4 odebrání
  1. 19 4
      src/client/js/components/ShareLinkForm.jsx

+ 19 - 4
src/client/js/components/ShareLinkForm.jsx

@@ -16,6 +16,7 @@ class ShareLinkForm extends React.Component {
       expirationType: 'unlimited',
       expirationType: 'unlimited',
       numberOfDays: 7,
       numberOfDays: 7,
       description: '',
       description: '',
+      customExpiration: new Date(),
     };
     };
 
 
     this.handleChangeExpirationType = this.handleChangeExpirationType.bind(this);
     this.handleChangeExpirationType = this.handleChangeExpirationType.bind(this);
@@ -48,6 +49,14 @@ class ShareLinkForm extends React.Component {
     this.setState({ description });
     this.setState({ description });
   }
   }
 
 
+  /**
+   * change customExpiration
+   * @param {date} customExpiration
+   */
+  handleChangeCustomExpiration(customExpiration) {
+    this.setState({ customExpiration });
+  }
+
   handleIssueShareLink() {
   handleIssueShareLink() {
     // use these options
     // use these options
     console.log(this.state);
     console.log(this.state);
@@ -83,13 +92,12 @@ class ShareLinkForm extends React.Component {
             name="expirationType"
             name="expirationType"
           />
           />
           <label className="custom-control-label" htmlFor="customRadio2">
           <label className="custom-control-label" htmlFor="customRadio2">
-
             <div className="row align-items-center m-0">
             <div className="row align-items-center m-0">
               <input
               <input
                 type="number"
                 type="number"
                 min="1"
                 min="1"
-                className="form-control col-4"
-                name="numberOfDays"
+                className="col-4"
+                name="expirationType"
                 value={this.state.numberOfDays}
                 value={this.state.numberOfDays}
                 onChange={e => this.handleChangeNumberOfDays(Number(e.target.value))}
                 onChange={e => this.handleChangeNumberOfDays(Number(e.target.value))}
               />
               />
@@ -110,8 +118,15 @@ class ShareLinkForm extends React.Component {
           />
           />
           <label className="custom-control-label" htmlFor="customRadio3">
           <label className="custom-control-label" htmlFor="customRadio3">
             Custom
             Custom
-            <div className="date-picker">Date Picker</div>
           </label>
           </label>
+          <input
+            type="date"
+            className="ml-3"
+            name="customExpiration"
+            value={this.state.customExpiration}
+            min={new Date()}
+            onChange={e => this.handleChangeCustomExpiration(e.target.value)}
+          />
         </div>
         </div>
       </div>
       </div>
     );
     );