File tree Expand file tree Collapse file tree 13 files changed +288
-4
lines changed Expand file tree Collapse file tree 13 files changed +288
-4
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,9 @@ $red-dark: #d51a52;
8
8
$blue-light : #527efe ;
9
9
$blue : #507ceb ;
10
10
$blue-dark : #3563e9 ;
11
+ $black-blue : #1a202c ;
11
12
$grey-extra-light : #ebf3ff ;
13
+ $grey-border : #e7eef6 ;
12
14
$grey-light : #d5dce8 ;
13
15
$grey : #90a3bf ;
14
16
$grey-dark : #7c8798 ;
@@ -23,6 +25,7 @@ $shadow-light: 0 4px 8px -2px rgb(0 85 255 / 16%);
23
25
$shadow : 0 2px 4px -2px rgb (0 44 132 / 6% );
24
26
$font-family : " Plus Jakarta Sans" , sans-serif ;
25
27
$font-weight-regular : 400 ;
28
+ $font-weight-normal : 500 ;
26
29
$font-weight-semibold : 600 ;
27
30
$font-weight-bold : 700 ;
28
31
$font-weight-extrabold : 800 ;
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ const paletteColors = {
14
14
const [ defaultColor ] = Object . keys ( paletteColors ) as Color [ ] ;
15
15
16
16
type Properties = {
17
- children : string ;
17
+ children : string | JSX . Element [ ] ;
18
18
className ?: string ;
19
19
color ?: Color ;
20
20
onClick ?: ( event : React . MouseEvent < HTMLButtonElement > ) => void ;
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ export { Radio } from './radio/radio.js';
22
22
export { Router } from './router/router.jsx' ;
23
23
export { RouterProvider } from './router-provider/router-provider.jsx' ;
24
24
export { Spinner } from './spinner/spinner.js' ;
25
+ export { StarRating } from './star-rating/star-rating.jsx' ;
25
26
export { Table } from './table/table.js' ;
26
27
export { Toggle } from './toggle/toggle.js' ;
27
28
export { Provider as StoreProvider } from 'react-redux' ;
Original file line number Diff line number Diff line change
1
+ import { IconName } from '~/libs/enums/icon-name.enum.js' ;
2
+
3
+ import { Icon } from '../components.js' ;
4
+ import styles from './styles.module.scss' ;
5
+
6
+ type Properties = {
7
+ rating : number ;
8
+ } ;
9
+
10
+ const StarRating : React . FC < Properties > = ( { rating } : Properties ) => {
11
+ const fullFieldStars = Math . floor ( rating ) ;
12
+ const allStarts = Math . ceil ( rating ) ;
13
+
14
+ const createStarItem = ( width : number , key : number ) : JSX . Element => {
15
+ return (
16
+ < div className = { styles . star } key = { key } >
17
+ < div className = { styles . placeholder } >
18
+ < Icon iconName = { IconName . STAR } > </ Icon >
19
+ </ div >
20
+ < div className = { styles . inner } style = { { width : `${ width } %` } } >
21
+ < Icon iconName = { IconName . STAR } > </ Icon >
22
+ </ div >
23
+ </ div >
24
+ ) ;
25
+ } ;
26
+
27
+ const createStars = ( ) : JSX . Element [ ] => {
28
+ const stars : JSX . Element [ ] = [ ] ;
29
+ for ( let index = 1 ; index <= 5 ; index ++ ) {
30
+ if ( fullFieldStars >= index ) {
31
+ stars . push ( createStarItem ( 100 , index ) ) ;
32
+ } else if ( allStarts >= index ) {
33
+ stars . push ( createStarItem ( ( rating - fullFieldStars ) * 100 , index ) ) ;
34
+ } else {
35
+ stars . push ( createStarItem ( 0 , index ) ) ;
36
+ }
37
+ }
38
+
39
+ return stars ;
40
+ } ;
41
+
42
+ return < div className = { styles . container } > { createStars ( ) } </ div > ;
43
+ } ;
44
+
45
+ export { StarRating } ;
Original file line number Diff line number Diff line change
1
+ .container {
2
+ display : flex ;
3
+ }
4
+
5
+ .star {
6
+ position : relative ;
7
+ }
8
+
9
+ .inner {
10
+ position : absolute ;
11
+ top : 0 ;
12
+ left : 0 ;
13
+ width : 0 ;
14
+ height : 100% ;
15
+ overflow : hidden ;
16
+ color : #ffd12d ;
17
+ white-space : nowrap ;
18
+ }
Original file line number Diff line number Diff line change
1
+ import { type ValueOf , TruckTowType } from 'shared/build' ;
2
+
3
+ import img1 from '~/assets/img/truck/type-1.svg' ;
4
+ import img2 from '~/assets/img/truck/type-2.svg' ;
5
+ import img3 from '~/assets/img/truck/type-3.svg' ;
6
+
7
+ const getTowTruckImage = ( type : ValueOf < typeof TruckTowType > ) : string => {
8
+ switch ( type ) {
9
+ case TruckTowType . FLATBED_OR_ROLLBACK : {
10
+ return img3 ;
11
+ }
12
+ case TruckTowType . HOOK_AND_CHAIN : {
13
+ return img3 ;
14
+ }
15
+ case TruckTowType . INTEGRATED : {
16
+ return img1 ;
17
+ }
18
+ case TruckTowType . WHEEL_LIFT : {
19
+ return img2 ;
20
+ }
21
+ }
22
+ } ;
23
+
24
+ export { getTowTruckImage } ;
Original file line number Diff line number Diff line change
1
+ @import " ../../../assets/css/styles.scss" ;
2
+
3
+ .container {
4
+ width : 100% ;
5
+ height : 212px ;
6
+ margin-bottom : 16px ;
7
+ padding : 7px 0 ;
8
+ background-color : white ;
9
+ border-radius : 10px ;
10
+ box-shadow : 0 2px 4px 0 rgba (173 164 164 / 15% );
11
+ }
12
+
13
+ .body {
14
+ display : flex ;
15
+ justify-content : space-between ;
16
+ width : 100% ;
17
+ padding : 0 24px 4px ;
18
+ }
19
+
20
+ .footer {
21
+ display : flex ;
22
+ justify-content : space-between ;
23
+ padding : 14px 24px 16px ;
24
+ border-top : 1px solid $grey-border ;
25
+ }
26
+
27
+ .description {
28
+ margin-top : 26px ;
29
+ }
30
+
31
+ .name {
32
+ color : $black-blue ;
33
+ font-weight : $font-weight-bold ;
34
+ font-size : 20px ;
35
+ }
36
+
37
+ .rating {
38
+ display : flex ;
39
+ align-items : center ;
40
+ gap : 7px ;
41
+ margin-top : 9px ;
42
+ }
43
+
44
+ .reviews {
45
+ color : $grey ;
46
+ font-weight : $font-weight-normal ;
47
+ font-size : 14px ;
48
+ }
49
+
50
+ .capacity {
51
+ display : flex ;
52
+ align-items : center ;
53
+ gap : 3px ;
54
+ margin-top : 13px ;
55
+ color : $grey ;
56
+ font-weight : $font-weight-bold ;
57
+ font-size : 14px ;
58
+ }
59
+
60
+ .aside {
61
+ display : flex ;
62
+ }
63
+
64
+ .img {
65
+ width : 267px ;
66
+ height : 127px ;
67
+ }
68
+
69
+ .info {
70
+ display : flex ;
71
+ align-items : center ;
72
+ gap : 23px ;
73
+ }
74
+
75
+ .price {
76
+ font-size : 20px ;
77
+ }
78
+
79
+ .bold {
80
+ font-weight : $font-weight-bold ;
81
+ }
82
+
83
+ .gray {
84
+ color : $grey ;
85
+ font-size : 14px ;
86
+ }
87
+
88
+ .badge {
89
+ height : 25px ;
90
+ margin-top : 27px ;
91
+ }
92
+
93
+ .km {
94
+ margin-left : 6px ;
95
+ }
You can’t perform that action at this time.
0 commit comments