kitchen-simulator 5.0.0-test.65 → 5.0.0-test.66

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitchen-simulator",
3
- "version": "5.0.0-test.65",
3
+ "version": "5.0.0-test.66",
4
4
  "description": "It is a kitchen simulator.",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -1,65 +1,58 @@
1
1
  import React from 'react';
2
2
  import * as PropTypes from 'prop-types';
3
- import styled from 'styled-components';
4
3
  import {
5
4
  DEFAULT_FONT_FAMILY,
6
5
  SECONDARY_PURPLE_COLOR,
7
6
  TEXT_COLOR_NEUTRAL_0
8
7
  } from '../../constants';
9
8
 
10
- const FlipWrapper = styled.div`
11
- display: flex;
12
- align-items: center;
13
- margin: 15px 0;
14
- justify-content: space-between;
15
- `;
16
-
17
- const FlipTitle = styled.span`
18
- margin-right: auto;
19
- color: ${SECONDARY_PURPLE_COLOR};
20
- font-family: ${DEFAULT_FONT_FAMILY};
21
- font-size: 16px;
22
- font-weight: 600;
23
- line-height: 18px;
24
- text-align: left;
25
- `;
26
- const FlipDescription = styled.span`
27
- margin-right: auto;
28
- color: ${TEXT_COLOR_NEUTRAL_0};
29
- font-family: ${DEFAULT_FONT_FAMILY};
30
- font-size: 13px;
31
- font-weight: 400;
32
- line-height: 18px;
33
- text-align: left;
34
- `;
35
- const FlipInfoWrapper = styled.div`
36
- display: flex;
37
- flex-direction: column;
38
- `;
39
-
40
- const FlipToggle = styled.div`
41
- display: flex;
42
- position: relative;
43
- align-items: center;
44
- justify-content: center;
45
- font-size: 14px;
46
- cursor: pointer;
47
- -webkit-user-select: none;
48
- -moz-user-select: none;
49
- -ms-user-select: none;
50
- user-select: none;
51
- `;
52
-
53
- const FlipToggleIcon = styled.div`
54
- top: 0;
55
- position: absolute;
56
- ${'' /* transition-duration: .3s; */}
57
- img {
58
- font-size: 1.4rem;
59
- box-sizing: border-box;
60
- border-radius: 50%;
9
+ const styles = {
10
+ flipWrapper: {
11
+ display: 'flex',
12
+ alignItems: 'center',
13
+ margin: '15px 0',
14
+ justifyContent: 'space-between'
15
+ },
16
+ flipTitle: {
17
+ marginRight: 'auto',
18
+ color: SECONDARY_PURPLE_COLOR,
19
+ fontFamily: DEFAULT_FONT_FAMILY,
20
+ fontSize: '16px',
21
+ fontWeight: 600,
22
+ lineHeight: '18px',
23
+ textAlign: 'left'
24
+ },
25
+ flipDescription: {
26
+ marginRight: 'auto',
27
+ color: TEXT_COLOR_NEUTRAL_0,
28
+ fontFamily: DEFAULT_FONT_FAMILY,
29
+ fontSize: '13px',
30
+ fontWeight: 400,
31
+ lineHeight: '18px',
32
+ textAlign: 'left'
33
+ },
34
+ flipInfoWrapper: {
35
+ display: 'flex',
36
+ flexDirection: 'column'
37
+ },
38
+ flipToggle: {
39
+ display: 'flex',
40
+ position: 'relative',
41
+ alignItems: 'center',
42
+ justifyContent: 'center',
43
+ fontSize: '14px',
44
+ cursor: 'pointer',
45
+ WebkitUserSelect: 'none',
46
+ MozUserSelect: 'none',
47
+ msUserSelect: 'none',
48
+ userSelect: 'none',
49
+ color: 'black'
50
+ },
51
+ flipToggleIcon: {
52
+ top: 0,
53
+ position: 'absolute'
61
54
  }
62
- `;
55
+ };
63
56
 
64
57
  export default function PropertyCheckbox({
65
58
  value,
@@ -77,37 +70,42 @@ export default function PropertyCheckbox({
77
70
  return onUpdate(_val);
78
71
  });
79
72
  }
80
-
81
73
  return onUpdate(val);
82
74
  };
83
75
 
84
76
  let activeStyle = value == 0 ? { left: 0 } : { right: 0 };
85
77
 
86
78
  return (
87
- <FlipWrapper>
88
- <FlipInfoWrapper>
89
- <FlipTitle>{configs.label}</FlipTitle>
79
+ <div style={styles.flipWrapper}>
80
+ <div style={styles.flipInfoWrapper}>
81
+ <span style={styles.flipTitle}>{configs.label}</span>
90
82
  {configs.description && (
91
- <FlipDescription>{configs.description}</FlipDescription>
83
+ <span style={styles.flipDescription}>{configs.description}</span>
92
84
  )}
93
- </FlipInfoWrapper>
94
- <FlipToggle style={{ color: 'black' }} onClick={e => update(!value)}>
85
+ </div>
86
+ <div style={styles.flipToggle} onClick={e => update(!value)}>
95
87
  <img
96
88
  src={`/assets/img/svg/bottombar/${
97
89
  value != 0 ? '2d3d_toggle_active.svg' : '2d3d_toggle.svg'
98
90
  }`}
99
91
  style={{ width: '55px', height: '30px' }}
100
92
  />
101
- <FlipToggleIcon style={{ ...activeStyle }}>
93
+ <div style={{ ...styles.flipToggleIcon, ...activeStyle }}>
102
94
  <img
103
95
  src={`/assets/img/svg/bottombar/${
104
96
  value != 0 ? '2d3d_button_active.svg' : '2d3d_button.svg'
105
97
  }`}
106
- style={{ width: '30px', height: '30px' }}
98
+ style={{
99
+ width: '30px',
100
+ height: '30px',
101
+ fontSize: '1.4rem',
102
+ boxSizing: 'border-box',
103
+ borderRadius: '50%'
104
+ }}
107
105
  />
108
- </FlipToggleIcon>
109
- </FlipToggle>
110
- </FlipWrapper>
106
+ </div>
107
+ </div>
108
+ </div>
111
109
  );
112
110
  }
113
111
 
@@ -2,43 +2,32 @@ import React from 'react';
2
2
  import * as PropTypes from 'prop-types';
3
3
  import { Seq } from 'immutable';
4
4
  import { FormLabel, FormSelect } from '../../components/style/export';
5
- import styled from 'styled-components';
6
5
  import { TEXT_COLOR_NEUTRAL_0, DEFAULT_FONT_FAMILY } from '../../constants';
7
6
 
8
- const EnumWrapper = styled.div`
9
- display: flex;
10
- align-items: center;
11
- margin-top: 3px;
12
- `;
13
-
14
- const EnumTitle = styled.span`
15
- margin-right: auto;
16
- width: 110px;
17
- color: ${TEXT_COLOR_NEUTRAL_0};
18
- font-family: ${DEFAULT_FONT_FAMILY};
19
-
20
- @media screen and (min-width: 1024) {
21
- font-size: 11px;
22
- }
23
- @media screen and (max-width: 1024) {
24
- font-size: 11px;
25
- }
26
- @media screen and (min-width: 1366) {
27
- font-size: 13px;
28
- }
29
- @media screen and (max-width: 1366) {
30
- font-size: 13px;
31
- }
32
- @media screen and (min-width: 1440) {
33
- font-size: 16px;
34
- }
35
- @media screen and (max-width: 1440) {
36
- font-size: 16px;
7
+ const styles = {
8
+ enumWrapper: {
9
+ display: 'flex',
10
+ alignItems: 'center',
11
+ marginTop: '3px'
12
+ },
13
+ enumTitle: {
14
+ marginRight: 'auto',
15
+ width: '110px',
16
+ color: TEXT_COLOR_NEUTRAL_0,
17
+ fontFamily: DEFAULT_FONT_FAMILY,
18
+ fontWeight: 400,
19
+ lineHeight: '15px',
20
+ textAlign: 'left',
21
+ fontSize: '11px'
37
22
  }
38
- font-weight: 400;
39
- line-height: 15px;
40
- text-align: left;
41
- `;
23
+ };
24
+
25
+ // Responsive font size adjustment
26
+ function getFontSize() {
27
+ if (window.innerWidth >= 1440) return '16px';
28
+ if (window.innerWidth >= 1366) return '13px';
29
+ return '11px';
30
+ }
42
31
 
43
32
  export default function PropertyEnum({
44
33
  value,
@@ -48,6 +37,16 @@ export default function PropertyEnum({
48
37
  internalState,
49
38
  state
50
39
  }) {
40
+ const [fontSize, setFontSize] = React.useState(getFontSize());
41
+
42
+ React.useEffect(() => {
43
+ function handleResize() {
44
+ setFontSize(getFontSize());
45
+ }
46
+ window.addEventListener('resize', handleResize);
47
+ return () => window.removeEventListener('resize', handleResize);
48
+ }, []);
49
+
51
50
  let update = val => {
52
51
  if (configs.hook) {
53
52
  return configs
@@ -56,13 +55,12 @@ export default function PropertyEnum({
56
55
  return onUpdate(_val);
57
56
  });
58
57
  }
59
-
60
58
  return onUpdate(val);
61
59
  };
62
60
 
63
61
  return (
64
- <EnumWrapper>
65
- <EnumTitle>{configs.label}</EnumTitle>
62
+ <div style={styles.enumWrapper}>
63
+ <span style={{ ...styles.enumTitle, fontSize }}>{configs.label}</span>
66
64
  <FormSelect value={value} onChange={event => update(event.target.value)}>
67
65
  {Seq(configs.values)
68
66
  .entrySeq()
@@ -72,7 +70,7 @@ export default function PropertyEnum({
72
70
  </option>
73
71
  ))}
74
72
  </FormSelect>
75
- </EnumWrapper>
73
+ </div>
76
74
  );
77
75
  }
78
76
 
@@ -17,48 +17,45 @@ import {
17
17
  } from '../../components/style/export';
18
18
  import { Map } from 'immutable';
19
19
  import { toFixedFloat } from '../../utils/math';
20
- import styled from 'styled-components';
21
20
 
22
- const DistanceFloorWrapper = styled.div`
23
- display: flex;
24
- align-items: center;
25
- margin-top: 3px;
26
- `;
27
-
28
- const DistanceFloorTitle = styled.span`
29
- margin-right: auto;
30
- width: 110px;
31
- color: ${TEXT_COLOR_NEUTRAL_0};
32
- font-family: ${DEFAULT_FONT_FAMILY};
33
- font-size: 16px;
34
-
35
- @media screen and (min-width: 1024) {
36
- font-size: 11px;
37
- }
38
- @media screen and (max-width: 1024) {
39
- font-size: 11px;
40
- }
41
- @media screen and (min-width: 1366) {
42
- font-size: 13px;
43
- }
44
- @media screen and (max-width: 1366) {
45
- font-size: 13px;
46
- }
47
- @media screen and (min-width: 1440) {
48
- font-size: 16px;
49
- }
50
- @media screen and (max-width: 1440) {
51
- font-size: 16px;
21
+ const styles = {
22
+ distanceFloorWrapper: {
23
+ display: 'flex',
24
+ alignItems: 'center',
25
+ marginTop: '3px'
26
+ },
27
+ distanceFloorTitle: {
28
+ marginRight: 'auto',
29
+ width: '110px',
30
+ color: TEXT_COLOR_NEUTRAL_0,
31
+ fontFamily: DEFAULT_FONT_FAMILY,
32
+ fontWeight: 400,
33
+ lineHeight: '15px',
34
+ textAlign: 'left'
52
35
  }
53
- font-weight: 400;
54
- line-height: 15px;
55
- text-align: left;
56
- `;
36
+ };
37
+
38
+ // Responsive font size adjustment
39
+ function getFontSize() {
40
+ if (window.innerWidth >= 1440) return '16px';
41
+ if (window.innerWidth >= 1366) return '13px';
42
+ return '11px';
43
+ }
57
44
 
58
45
  export default function PropertyLengthMeasure(
59
46
  { value, onUpdate, onValid, configs, sourceElement, internalState, state },
60
47
  { catalog }
61
48
  ) {
49
+ const [fontSize, setFontSize] = React.useState(getFontSize());
50
+
51
+ React.useEffect(() => {
52
+ function handleResize() {
53
+ setFontSize(getFontSize());
54
+ }
55
+ window.addEventListener('resize', handleResize);
56
+ return () => window.removeEventListener('resize', handleResize);
57
+ }, []);
58
+
62
59
  let _unit = value.get('_unit');
63
60
  let unit = state.getIn([
64
61
  'scene',
@@ -99,8 +96,8 @@ export default function PropertyLengthMeasure(
99
96
  };
100
97
 
101
98
  return (
102
- <DistanceFloorWrapper>
103
- <DistanceFloorTitle>{label}</DistanceFloorTitle>
99
+ <div style={styles.distanceFloorWrapper}>
100
+ <span style={{ ...styles.distanceFloorTitle, fontSize }}>{label}</span>
104
101
  <FormNumberInput
105
102
  disabled={type === TALL_CABINET_LAYOUTPOS}
106
103
  value={convert(_length).from('in').to(unit)}
@@ -110,7 +107,7 @@ export default function PropertyLengthMeasure(
110
107
  style={{ paddingRight: '40px' }}
111
108
  {...configRest}
112
109
  />
113
- </DistanceFloorWrapper>
110
+ </div>
114
111
  );
115
112
  }
116
113
 
@@ -1,34 +1,8 @@
1
1
  import React, { Component } from 'react';
2
2
  import * as PropTypes from 'prop-types';
3
- import {
4
- KEYBOARD_BUTTON_CODE,
5
- TEXT_COLOR_NEUTRAL_0,
6
- SECONDARY_PURPLE_COLOR,
7
- DEFAULT_FONT_FAMILY
8
- } from '../../constants';
3
+ import { KEYBOARD_BUTTON_CODE } from '../../constants';
9
4
  import { isValidNumber } from '../../utils/helper';
10
5
 
11
- // import styled from 'styled-components';
12
- // const StyledInput = styled.input`
13
- // display: block;
14
- // padding: 15px 25px 12px 0px;
15
- // width: 120px;
16
- // color: ${TEXT_COLOR_NEUTRAL_0};
17
- // background-color: rgb(255, 255, 255);
18
- // border: 2px solid;
19
- // text-align: right;
20
- // float: right;
21
- // font-family: ${DEFAULT_FONT_FAMILY};
22
- // font-size: 16px;
23
- // font-weight: 600;
24
- // line-height: 17px;
25
- // border-radius: 5px;
26
- // outline: 0;
27
- // :focus {
28
- // border-color: ${SECONDARY_PURPLE_COLOR};
29
- // }
30
- // `;
31
-
32
6
  export default class FormNumberInput extends Component {
33
7
  constructor(props, context) {
34
8
  super(props, context);
@@ -1,32 +1,4 @@
1
1
  import React from 'react';
2
- import {
3
- TEXT_COLOR_NEUTRAL_3,
4
- DEFAULT_FONT_FAMILY,
5
- SECONDARY_PURPLE_COLOR
6
- } from '../../constants';
7
-
8
- // import styled from 'styled-components';
9
- // const StyledSelect = styled.select`
10
- // display: block;
11
- // width: 120px;
12
- // float: right;
13
- // padding: 15px 10px 12px 0px;
14
- // color: ${TEXT_COLOR_NEUTRAL_3};
15
- // border: 2px solid;
16
- // font-family: ${DEFAULT_FONT_FAMILY};
17
- // font-size: 12px;
18
- // font-weight: 600;
19
- // line-height: 17px;
20
- // text-align: right;
21
- // outline: none;
22
- // border-radius: 5px;
23
- // :hover {
24
- // border-color: ${SECONDARY_PURPLE_COLOR};
25
- // }
26
- // :focus {
27
- // border-color: ${SECONDARY_PURPLE_COLOR};
28
- // }
29
- // `;
30
2
 
31
3
  export default function FormSelect({ children, style, ...rest }) {
32
4
  return (