Sfoglia il codice sorgente

added component CardPopup and CardPopupCreateContent

Skylsmoi 6 anni fa
parent
commit
3035bbe0e1

+ 35 - 0
src/component/CardPopup/CardPopup.jsx Vedi File

@@ -0,0 +1,35 @@
1
+import React from 'react'
2
+import PropTypes from 'prop-types'
3
+import classnames from 'classnames'
4
+
5
+require('./CardPopup.styl')
6
+
7
+const CardPopup = props => {
8
+  return (
9
+    <div className={classnames(props.customClass, 'cardPopup')}>
10
+      <div className='cardPopup__container'>
11
+        <div className='cardPopup__header' />
12
+
13
+        <div className='cardPopup__close' onClick={props.onClose}>
14
+          <i className='fa fa-times' />
15
+        </div>
16
+
17
+        <div className='cardPopup__body'>
18
+          { props.children }
19
+        </div>
20
+      </div>
21
+    </div>
22
+  )
23
+}
24
+
25
+export default CardPopup
26
+
27
+CardPopup.propTypes = {
28
+  customClass: PropTypes.string,
29
+  onClose: PropTypes.func
30
+}
31
+
32
+CardPopup.defaultProps = {
33
+  customClass: 'defaultCustomClass',
34
+  onClose: () => {}
35
+}

+ 39 - 0
src/component/CardPopup/CardPopup.styl Vedi File

@@ -0,0 +1,39 @@
1
+@import '../../css/Variable.styl'
2
+
3
+.cardPopup
4
+  position fixed
5
+  display flex
6
+  justify-content center
7
+  width 100%
8
+  z-index 10
9
+  &__container
10
+    margin-top 50px
11
+    border 0
12
+    border-radius 10px
13
+    width 800px
14
+    background lightGrey
15
+    box-shadow shadow-all
16
+  &__header
17
+    border-top-right-radius 10px
18
+    border-top-left-radius 10px
19
+    width 100%
20
+    height 8px
21
+  &__close
22
+    display flex
23
+    justify-content flex-end
24
+    padding 5px 15px 5px 5px
25
+    cursor pointer
26
+  &__body
27
+    display flex
28
+    align-items center
29
+    padding 10px 15px 15px 15px
30
+    &__icon
31
+      padding 0 30px
32
+      font-size 40px
33
+    &__text
34
+      &__title
35
+        font-size 20px
36
+        font-weight 600
37
+      &__message
38
+        padding-right 20px
39
+        font-weight 500

+ 62 - 0
src/component/CardPopup/CardPopupCreateContent.jsx Vedi File

@@ -0,0 +1,62 @@
1
+import React from 'react'
2
+import PropTypes from 'prop-types'
3
+import CardPopup from './CardPopup.jsx'
4
+
5
+require('./CardPopupCreateContent.styl')
6
+
7
+const PopupCreateContent = props => {
8
+  return (
9
+    <CardPopup customClass='popupCreateContent' onClose={props.onClose}>
10
+      <div className='createcontent'>
11
+        <div className='createcontent__contentname mb-4'>
12
+          <div className='createcontent__contentname__icon ml-1 mr-3'>
13
+            <i className={`fa ${props.icon}`} style={{color: props.color}} />
14
+          </div>
15
+
16
+          <div className='createcontent__contentname__title' style={{color: props.color}}>
17
+            {props.title}
18
+          </div>
19
+        </div>
20
+
21
+        <form className='createcontent__form'>
22
+          <input
23
+            type='text'
24
+            className='createcontent__form__input'
25
+            value={props.contentName}
26
+            onChange={props.onChangeContentName}
27
+          />
28
+
29
+          <div className='createcontent__form__button'>
30
+            <button
31
+              className='createcontent__form__button btn btn-primary'
32
+              type='submit'
33
+              onClick={props.onValidate}
34
+            >
35
+              {props.btnValidateLabel}
36
+            </button>
37
+          </div>
38
+        </form>
39
+      </div>
40
+    </CardPopup>
41
+  )
42
+}
43
+
44
+PopupCreateContent.propTypes = {
45
+  onClose: PropTypes.func.isRequired,
46
+  onValidate: PropTypes.func.isRequired,
47
+  contentName: PropTypes.string.isRequired,
48
+  onChangeContentName: PropTypes.func.isRequired,
49
+  title: PropTypes.string,
50
+  color: PropTypes.string,
51
+  btnValidateLabel: PropTypes.string
52
+}
53
+
54
+PopupCreateContent.defaultProps = {
55
+  title: '',
56
+  color: '#333',
57
+  inputPlaceHolder: '',
58
+  btnValidateLabel: ''
59
+}
60
+
61
+
62
+export default PopupCreateContent

+ 46 - 0
src/component/CardPopup/CardPopupCreateContent.styl Vedi File

@@ -0,0 +1,46 @@
1
+@import '../../css/Variable.styl'
2
+
3
+.popupCreateContent
4
+  position fixed
5
+  top 0
6
+  left 0
7
+  display flex
8
+  justify-content center
9
+  width 100%
10
+  z-index 5
11
+  .cardPopup__container
12
+    margin-top 120px
13
+    border 0
14
+    border-radius 10px
15
+    width 400px
16
+    background lightGrey
17
+    box-shadow shadow-all
18
+  &__header
19
+    border-top-right-radius 10px
20
+    border-top-left-radius 10px
21
+    width 100%
22
+    height 8px
23
+    background-color fileColor
24
+  .createcontent
25
+    width 100%
26
+    &__close
27
+      cursor pointer
28
+    &__contentname
29
+      display flex
30
+      align-items baseline
31
+      &__icon
32
+        font-size 30px
33
+      &__title
34
+        font-size 20px
35
+        color htmlColor
36
+    &__form
37
+      &__input
38
+        width 100%
39
+        border 1px solid grey
40
+        border-radius 5px
41
+        margin-bottom 25px
42
+        padding 5px
43
+      &__button
44
+        display flex
45
+        justify-content flex-end
46
+        cursor pointer

+ 1 - 1
src/component/PopinFixed/PopinFixed.jsx Vedi File

@@ -9,7 +9,7 @@ require('./PopinFixed.styl')
9 9
 
10 10
 const PopinFixed = props => {
11 11
   return (
12
-    <div className={classnames('wsContentGeneric', props.customClass, {'visible': props.visible})}>
12
+    <div className={classnames('wsContentGeneric', props.customClass, {'visible': props.visible})} style={props.style}>
13 13
       {props.children}
14 14
     </div>
15 15
   )

+ 42 - 28
src/index.dev.js Vedi File

@@ -14,35 +14,49 @@ import TimelineDebugData from './component/Timeline/debugData.js'
14 14
 
15 15
 import Delimiter from './component/Delimiter/Delimiter.jsx'
16 16
 
17
-ReactDOM.render(
18
-  <PopinFixed customClass={`${'randomClass'}`}>
19
-    <PopinFixedHeader
20
-      customClass={`${'randomClass'}`}
21
-      icon={'fa fa-file-word-o'}
22
-      name={'test exemple'}
23
-      onClickCloseBtn={() => {}}
24
-    />
17
+import CardPopup from './component/CardPopup/CardPopup.jsx'
18
+import CardPopupCreateContent from './component/CardPopup/CardPopupCreateContent.jsx'
25 19
 
26
-    <PopinFixedOption customClass={`${'randomClass'}`} />
27
-
28
-    <PopinFixedContent customClass={`${'randomClass'}__contentpage`}>
29
-      <div>
30
-        <Delimiter />
31
-        <span>Here will be the app content. Style is handled by the app (obviously)</span>
32
-        <BtnSwitch />
33
-        <TextAreaApp customClass={'randomClass'} />
34
-      </div>
35
-
36
-      <Timeline
37
-        customClass={`${'randomClass'}__contentpage`}
38
-        loggedUser={{
39
-          id: 1,
40
-          name: 'smoi',
41
-          avatar: 'https://www.algoo.fr/static/images/algoo_images/algoo-logo.jpg'
42
-        }}
43
-        timelineData={TimelineDebugData}
20
+ReactDOM.render(
21
+  <div>
22
+    <PopinFixed customClass={`${'randomClass'}`} style={{display: 'none'}}>
23
+      <PopinFixedHeader
24
+        customClass={`${'randomClass'}`}
25
+        icon={'fa fa-file-word-o'}
26
+        name={'test exemple'}
27
+        onClickCloseBtn={() => {}}
44 28
       />
45
-    </PopinFixedContent>
46
-  </PopinFixed>
29
+
30
+      <PopinFixedOption customClass={`${'randomClass'}`} />
31
+
32
+      <PopinFixedContent customClass={`${'randomClass'}__contentpage`}>
33
+        <div>
34
+          <Delimiter />
35
+          <span>Here will be the app content. Style is handled by the app (obviously)</span>
36
+          <BtnSwitch />
37
+          <TextAreaApp customClass={'randomClass'} />
38
+        </div>
39
+
40
+        <Timeline
41
+          customClass={`${'randomClass'}__contentpage`}
42
+          loggedUser={{
43
+            id: 1,
44
+            name: 'smoi',
45
+            avatar: 'https://www.algoo.fr/static/images/algoo_images/algoo-logo.jpg'
46
+          }}
47
+          timelineData={TimelineDebugData}
48
+        />
49
+      </PopinFixedContent>
50
+    </PopinFixed>
51
+
52
+    <CardPopupCreateContent
53
+      onClose={() => {}}
54
+      icon='fa-file-word-o'
55
+      color='#3f52e3'
56
+      title='Exemple of popup create content'
57
+      inputPlaceHolder='Exemple placeholder'
58
+      btnValidateLabel='Valider et créer'
59
+    />
60
+  </div>
47 61
   , document.getElementById('content')
48 62
 )

+ 6 - 0
src/index.js Vedi File

@@ -14,6 +14,9 @@ import libBtnSwitch from './component/Input/BtnSwitch/BtnSwitch.jsx'
14 14
 
15 15
 import libDelimiter from './component/Delimiter/Delimiter.jsx'
16 16
 
17
+import libCardPopup from './component/CardPopup/CardPopup.jsx'
18
+import libCardPopupCreateContent from './component/CardPopup/CardPopupCreateContent.jsx'
19
+
17 20
 export const langFr = fr
18 21
 export const langEn = en
19 22
 
@@ -30,3 +33,6 @@ export const TextAreaApp = libTextAreaApp
30 33
 export const BtnSwitch = libBtnSwitch
31 34
 
32 35
 export const Delimiter = libDelimiter
36
+
37
+export const CardPopup = libCardPopup
38
+export const CardPopupCreateContent = libCardPopupCreateContent