imbric-theme 0.6.4 → 0.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,21 +6,23 @@ import Icon from '../Icon'
6
6
  import styles from './Check.module.css'
7
7
  import withStyles from '../../hocs/withStyles'
8
8
 
9
- export const Check = ({ isChecked, getStyles }) => {
9
+ export const Check = ({ isChecked, getStyles, onClickChecked }) => {
10
10
  return isChecked ? (
11
- <Icon name="checkCircle" color="muted" isClickable />
11
+ <Icon name="checkCircle" color="muted" isClickable onClick={onClickChecked} />
12
12
  ) : (
13
- <span className={getStyles('check')} />
13
+ <span onClick={onClickChecked} className={getStyles('check')} />
14
14
  )
15
15
  }
16
16
 
17
17
  Check.propTypes = {
18
18
  getStyles: PropTypes.func.isRequired,
19
19
  isChecked: PropTypes.bool,
20
+ onClickChecked: PropTypes.func,
20
21
  }
21
22
 
22
23
  Check.defaultProps = {
23
- getStyles: () => {},
24
+ getStyles: () => { },
25
+ onClickChecked: () => { },
24
26
  }
25
27
 
26
28
  export default withStyles(styles)(Check)
@@ -1,5 +1,6 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
+ import Link from 'next/link'
3
4
 
4
5
  import styles from './Picture.module.css'
5
6
  import withStyles from '../../hocs/withStyles'
@@ -11,6 +12,7 @@ export const Picture = ({
11
12
  height,
12
13
  isRounded,
13
14
  withBorder,
15
+ isHref,
14
16
  }) => (
15
17
  <picture
16
18
  className={getStyles('picture', {
@@ -18,7 +20,10 @@ export const Picture = ({
18
20
  'with-border': withBorder,
19
21
  })}
20
22
  >
21
- <img src={src} style={{ height, maxWidth: width }} />
23
+ <Link href={isHref} passHref>
24
+ <img src={src} style={{ height, maxWidth: width }} />
25
+ </Link>
26
+
22
27
  </picture>
23
28
  )
24
29
 
@@ -29,12 +34,14 @@ Picture.propTypes = {
29
34
  height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
30
35
  isRounded: PropTypes.bool,
31
36
  withBorder: PropTypes.bool,
37
+ isHref: PropTypes.any
32
38
  }
33
39
 
34
40
  Picture.defaultProps = {
35
41
  height: 'auto',
36
42
  withBorder: false,
37
- getStyles: () => {},
43
+ getStyles: () => { },
44
+ isHref: ''
38
45
  }
39
46
 
40
47
  export default withStyles(styles)(Picture)
@@ -6,11 +6,11 @@ import withStyles from '../../hocs/withStyles'
6
6
 
7
7
  export const Toggle = ({ getStyles, onChangeCheckbox, disabled, id, checked, name }) => {
8
8
 
9
- const [isChecked, setIsChecked] = useState(false);
9
+ // const [isChecked, setIsChecked] = useState(false);
10
10
 
11
- const handleOnChange = () => {
12
- setIsChecked(!isChecked)
13
- };
11
+ // const handleOnChange = () => {
12
+ // setIsChecked(!isChecked)
13
+ // };
14
14
 
15
15
 
16
16
  return <div className={getStyles('toggle')}>
@@ -20,9 +20,10 @@ export const Toggle = ({ getStyles, onChangeCheckbox, disabled, id, checked, nam
20
20
  id={id}
21
21
  name={name}
22
22
  disabled={disabled}
23
- checked={isChecked || checked}
23
+ // checked={isChecked || checked}
24
+ checked={checked}
24
25
  onChange={(e) => {
25
- handleOnChange()
26
+ // handleOnChange()
26
27
  onChangeCheckbox(e)
27
28
  }}
28
29
  className={getStyles('toggle-item')}
@@ -1,6 +1,7 @@
1
1
  import React, { ReactNode, useRef, useState, useEffect } from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import withStyles from '../../hocs/withStyles'
4
+ import { useRouter } from 'next/router'
4
5
 
5
6
  // import { options } from './constants'
6
7
 
@@ -11,8 +12,9 @@ import Icon from '../../atoms/Icon'
11
12
  import Divider from '../../atoms/Divider'
12
13
  import ItemMenu from '../../molecules/ItemMenu/ItemMenu'
13
14
 
14
- export const Sidebar = ({ getStyles, menuCollapseView, options }) => {
15
+ export const Sidebar = ({ getStyles, menuCollapseView, options, isHrefLogo }) => {
15
16
 
17
+ const router = useRouter()
16
18
 
17
19
  return (
18
20
  <>
@@ -30,7 +32,7 @@ export const Sidebar = ({ getStyles, menuCollapseView, options }) => {
30
32
 
31
33
  <div className={getStyles('logotext')}>
32
34
  {/* small and big change using menuCollapseView state */}
33
- {menuCollapseView ? <Picture src="/static/logotipoS.svg" width={19}></Picture> : <Picture src="/static/logotipo.svg" width={100}></Picture>}
35
+ {menuCollapseView ? <Picture isHref={isHrefLogo} src={router.basePath + "/static/logotipoS.svg"} width={19}></Picture> : <Picture isHref={isHrefLogo} src={router.basePath + "/static/logotipo.svg"} width={100}></Picture>}
34
36
  </div>
35
37
  {/* <div className={getStyles('closemenu')}>
36
38
 
@@ -69,7 +71,7 @@ export const Sidebar = ({ getStyles, menuCollapseView, options }) => {
69
71
  >
70
72
  {item.text}
71
73
  </ItemMenu>
72
-
74
+
73
75
  : null
74
76
 
75
77
  ))}
@@ -93,6 +95,7 @@ export const Sidebar = ({ getStyles, menuCollapseView, options }) => {
93
95
 
94
96
  Sidebar.propTypes = {
95
97
  getStyles: PropTypes.func.isRequired,
98
+ isHrefLogo: PropTypes.any
96
99
  // options: PropTypes.arrayOf(
97
100
  // PropTypes.shape({
98
101
  // text: PropTypes.string,
@@ -104,6 +107,7 @@ Sidebar.propTypes = {
104
107
  Sidebar.defaultProps = {
105
108
  getStyles: () => { },
106
109
  menuCollapseView: false,
110
+ isHrefLogo: ''
107
111
  }
108
112
 
109
113
  export default withStyles(styles)(Sidebar)
@@ -13,117 +13,123 @@ import { Horizontal, Vertical } from '../../layout/Spacer/components'
13
13
 
14
14
  export const ColumnTable = ({ getStyles, handleSorting, columnUppercase, onChangeInput, onChangeSelect, columnsData, opSelect }) => {
15
15
 
16
- const [sortable, setSortable] = useState(true);
17
- const [accessor, setAccessor] = useState("");
18
- const [sortField, setSortField] = useState("");
19
- const [order, setOrder] = useState("asc");
16
+ // const [sortable, setSortable] = useState(true)
17
+ // const [accessor, setAccessor] = useState("")
18
+
19
+ const [sortField, setSortField] = useState("")
20
+ const [order, setOrder] = useState("asc")
20
21
 
21
22
  // const [optionsSelect, setOptionsSelect] = useState(opSelect);
22
23
 
23
24
 
24
25
  const handleSortingChange = (accessor) => {
25
26
  const sortOrder =
26
- accessor === sortField && order === "asc" ? "desc" : "asc";
27
- setSortField(accessor);
28
- setOrder(sortOrder);
29
- handleSorting(accessor, sortOrder);
30
- };
27
+ accessor === sortField && order === "asc" ? "desc" : "asc"
31
28
 
32
- const cl = sortable
33
- ? sortField && sortField === accessor && order === "asc"
34
- ? "angleUp"
35
- : sortField && sortField === accessor && order === "desc"
36
- ? "angleDown"
37
- : "default"
38
- : "";
29
+ setSortField(accessor)
30
+ setOrder(sortOrder)
31
+ handleSorting(accessor, sortOrder)
32
+ };
39
33
 
40
34
 
41
35
  return (
42
36
 
43
- <div className={getStyles('tbl-header')}>
44
- <table className={getStyles('table')} cellPadding="0" cellSpacing="0" border="0">
45
- <thead>
46
- <tr>
47
-
48
- {columnsData.map((item) => (
49
- item.activeView ?
50
- // setSortable(item.sortable)
51
- // setAccessor()
52
- (<th
53
- key={item.idInput}
54
- className={getStyles('column-table',
55
- {'column-uppercase': columnUppercase},
56
- {'thacction': item.accessor === 'iconUrl' } ,
57
- {'thcheckbox': item.isCheckbox }
58
- )}>
59
-
60
- <span onClick={item.sortable ? () => handleSortingChange(item.accessor) : null}>
61
- <Paragraph
62
- size="xs"
63
- isInline
64
- >
65
- {item.title}
66
- </Paragraph>
67
-
68
- <Horizontal size="xs" />
69
-
70
- {item.sortable ?
71
-
72
- cl === "default" ?
73
- <Icon
74
- name="angleUpDown"
75
- size="xs"
76
- />
77
- : cl === "" ? null
78
-
79
- : cl === "angleDown"
80
- ? <Icon
81
- name="angleDown"
82
- size="xs"
83
- />
84
-
85
- : <Icon
86
- name="angleUp"
87
- size="xs"
88
- />
89
- : null
90
- }
91
- </span>
92
-
93
-
94
- <Vertical size="xs" />
95
-
96
- {item.viewIsFilter ? (
97
-
98
- item.typeFilter === 'select' ?
99
- <DynamicSelect
100
- isInline
101
- onChange={onChangeSelect}
102
- optionsSelect={opSelect}
103
- placeholder={item.placeholder}
104
- />
105
- :
106
- <Input
107
- isInputFilter
108
- id={item.idInput}
109
- type={item.typeFilter}
110
- name={item.nameInput}
111
- onChange={onChangeInput}
112
- placeholder={item.placeholder}
37
+ // <div className={getStyles('tbl-header')}>
38
+ // <table className={getStyles('table')} cellPadding="0" cellSpacing="0" border="0">
39
+ <thead>
40
+ <tr>
41
+
42
+ {columnsData.map(({ accessor, sortable, ...props }) => {
43
+
44
+ const cl = sortable
45
+ ? sortField && sortField === accessor && order === "asc"
46
+ ? "up"
47
+ : sortField && sortField === accessor && order === "desc"
48
+ ? "down"
49
+ : "default"
50
+ : "";
51
+
52
+ return (
53
+ props.activeView ?
54
+ // setSortable(props.sortable)
55
+ // setAccessor()
56
+ (<th
57
+ key={props.idInput}
58
+ className={getStyles('column-table',
59
+ { 'column-uppercase': columnUppercase },
60
+ { 'thacction': accessor === 'iconUrl' },
61
+ { 'thcheckbox': props.isCheckbox }
62
+ )}>
63
+
64
+ <span className={getStyles('tbl-txtTh')} onClick={sortable ? () => handleSortingChange(accessor) : null}>
65
+ <Paragraph
66
+ size="xs"
67
+ isInline
68
+ >
69
+ {props.title}
70
+ </Paragraph>
71
+
72
+ <Horizontal size="xs" />
73
+
74
+ {sortable ?
75
+
76
+ cl === "default" ?
77
+ <Icon
78
+ name="angleUpDown"
79
+ size="xs"
113
80
  />
114
- )
115
-
81
+ : cl === "" ? null
82
+
83
+ : cl === "up"
84
+ ? <Icon
85
+ name="angleDown"
86
+ size="xs"
87
+ />
88
+
89
+ : <Icon
90
+ name="angleUp"
91
+ size="xs"
92
+ />
116
93
  : null
117
94
  }
95
+ </span>
96
+
118
97
 
119
- </th>
120
- ) : null
121
- ))}
98
+ <Vertical size="xs" />
122
99
 
123
- </tr>
124
- </thead>
125
- </table>
126
- </div>
100
+ {props.viewIsFilter ? (
101
+
102
+ props.typeFilter === 'select' ?
103
+ <DynamicSelect
104
+ isInline
105
+ onChange={onChangeSelect}
106
+ optionsSelect={opSelect}
107
+ placeholder={props.placeholder}
108
+ />
109
+ :
110
+ <Input
111
+ isInputFilter
112
+ id={props.idInput}
113
+ type={props.typeFilter}
114
+ name={props.nameInput}
115
+ onChange={onChangeInput}
116
+ placeholder={props.placeholder}
117
+ />
118
+ )
119
+
120
+ : null
121
+ }
122
+
123
+ </th>
124
+ ) : null
125
+ )
126
+
127
+ })}
128
+
129
+ </tr>
130
+ </thead>
131
+ // </table>
132
+ // </div>
127
133
 
128
134
  )
129
135
  }
@@ -1,15 +1,27 @@
1
1
  .column-table {
2
- padding: 12px 15px;
2
+ padding: 12px 12px;
3
3
  text-align: left;
4
4
  color: var(--color-font-base);
5
5
  display: table-cell;
6
6
  vertical-align: top;
7
+ /* overflow: hidden;
8
+ text-overflow: ellipsis; */
9
+ border-bottom-color: rgba(0, 0, 0, 0.12);
10
+ border-bottom-width: 1px;
11
+ border-bottom-style: solid;
7
12
  }
8
13
 
9
14
  .column-uppercase {
10
15
  text-transform: uppercase;
11
16
  }
12
17
 
18
+ .tbl-txtTh {
19
+ overflow: hidden;
20
+ text-overflow: ellipsis;
21
+ white-space: nowrap;
22
+ cursor: pointer;
23
+ }
24
+
13
25
  .table {
14
26
  width: 100%;
15
27
  table-layout: fixed;
@@ -5,6 +5,7 @@ import PropTypes from 'prop-types'
5
5
  import styles from './InputAutocomplete.module.css'
6
6
  import { options } from './constants'
7
7
  import withStyles from '../../hocs/withStyles'
8
+ import { useRouter } from 'next/router'
8
9
 
9
10
  import { BarLoader, ClipLoader } from 'react-spinners'
10
11
  import Input from '../../atoms/Input'
@@ -73,6 +74,8 @@ export const InputAutocomplete = ({
73
74
 
74
75
  // }
75
76
 
77
+ const router = useRouter()
78
+
76
79
 
77
80
  return <div className={getStyles('input-autocomplete')}>
78
81
 
@@ -127,11 +130,11 @@ export const InputAutocomplete = ({
127
130
  <li id={'idLiItem' + index} key={index} className={getStyles('input-autocomplete-li')} onClick={handleOnSelect}>
128
131
  {viewIconList ?
129
132
  <div className={getStyles('input-autocomplete-li-icon')}>
130
- <Picture
131
- src={itemAddresses.iconURL ? itemAddresses.iconURL : "../../static/google-maps.png"}
132
- width={15}
133
- height={15}
134
- />
133
+ <Picture
134
+ src={itemAddresses.iconURL ? itemAddresses.iconURL : router.basePath + "/static/google-maps.png"}
135
+ width={15}
136
+ height={15}
137
+ />
135
138
  </div>
136
139
  :
137
140
  null