hds-web 1.3.1 → 1.3.2

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": "hds-web",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -1,23 +1,22 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { Typography } from '../../foundation/Typography'
4
- import { Icon } from '../common-components/Icon';
3
+ import {Typography} from '../../foundation/Typography'
5
4
 
6
5
  export default function HasConAvatar({ name, designation, size, imageUrl }) {
7
6
  const hasImageUrl = imageUrl && imageUrl.length > 0;
8
7
  return (
9
- <div className={`${size} group rounded-3xl flex items-center justify-between bg-neutral-0 tb:inline-flex tb:flex-col shadow hover:shadow-xl tb:min-w-[18rem]`}>
8
+ <div className={`${size} tb:max-w-[289px] group rounded-3xl flex items-center justify-between bg-neutral-0 tb:inline-flex tb:flex-col shadow hover:shadow-xl tb:min-w-[18rem]`}>
10
9
 
11
- <div className="tb:flex-col tb:flex tb:items-center tb:px-8 tb:pb-8 tb:mt-8 tb:ml-0 bg-neutral-0 text-center">
10
+ <div className="px-5 py-[30px] tb:p-0 text-left tb:flex-col min-h-[96px] tb:flex tb:items-center tb:px-8 tb:pb-8 tb:mt-8 tb:ml-0 tb-l:text-center">
12
11
  <Typography textStyle='body1c-bold' className='text-blue-400'>{name}</Typography>
13
12
  <Typography textStyle='body3c-medium' className='text-blue-800'>{designation}</Typography>
14
13
  </div>
15
- <div className='relative '>
14
+ <div className='relative self-center'>
16
15
  <img
17
- className={`inline-block w-[9rem] tb:min-w-[18rem] tb:rounded border-neutral-0 rounded-r-2xl `}
16
+ className={`inline-block min-w-[100px] w-[9rem] tb:min-w-[18rem] tb:rounded border-neutral-0 tb-l:rounded-r-2xl `}
18
17
  src={imageUrl}
19
18
  />
20
- <div className="absolute rounded-b-3xl inset-0 group-hover:bg-gradient-to-t group-hover:from-amber-200 group-hover:to-transparent group-hover:opacity-30" ></div>
19
+ <div className="absolute tb-l:rounded-b-3xl inset-0 group-hover:bg-gradient-to-t group-hover:from-amber-200 group-hover:to-transparent group-hover:opacity-30" ></div>
21
20
  </div>
22
21
 
23
22
 
@@ -1,37 +1,9 @@
1
1
  import React from "react";
2
2
  import { Icon } from "../common-components/Icon";
3
- import { HasConAvatar } from "../Avatars";
4
3
  export default function Carouseltest(props) {
5
4
  const [currentCard, setCurrentCard] = React.useState(0);
6
5
  const [touchStart, setTouchStart] = React.useState(0);
7
6
  const [touchEnd, setTouchEnd] = React.useState(0);
8
- const [visibleCardsContainerWidth, setvisibleCardsContainerWidth] = React.useState(0);
9
- const [cardWidth, setcardWidth] = React.useState(0);
10
- const [totalContainerWidth, setTotalContainerWidth] = React.useState(0);
11
- const [totalClick, setTotalClick] = React.useState(1);
12
- const [totalCards, setTotalCards] = React.useState(0);
13
- React.useEffect(() => {
14
- const visibleCardsContainerWidth = refs[0]?.current?.parentNode?.offsetWidth;
15
- setvisibleCardsContainerWidth(visibleCardsContainerWidth);
16
- const cardWidth = refs[0]?.current?.getBoundingClientRect().width;
17
- setcardWidth(cardWidth);
18
-
19
- const totalCardsWidth = Object.values(refs).reduce((acc, ref) => {
20
- const rect = ref.current.getBoundingClientRect();
21
- return acc + rect.width + parseFloat(getComputedStyle(ref.current).marginLeft) + parseFloat(getComputedStyle(ref.current).marginRight);
22
- }, 0);
23
- setTotalContainerWidth(totalCardsWidth);
24
- const noOfcardsinaview = (visibleCardsContainerWidth/cardWidth);
25
-
26
- const cardLength = props.length;
27
- setTotalCards(cardLength);
28
-
29
- setTotalClick(2*(cardLength/noOfcardsinaview));
30
-
31
-
32
-
33
- }, []);
34
-
35
7
 
36
8
  const handleTouchStart = e => {
37
9
  setTouchStart(e.targetTouches[0].clientX);
@@ -51,25 +23,28 @@ export default function Carouseltest(props) {
51
23
  }
52
24
  };
53
25
 
54
-
55
26
  const refs = props.cards.reduce((acc, val, i) => {
56
27
  acc[i] = React.createRef();
57
28
  return acc;
58
29
  }, {});
59
30
 
60
- const scrollToCard = i => {
31
+ const scrollToCard = (i) => {
61
32
  setCurrentCard(i);
33
+
34
+ if (refs[i] && refs[i].current) {
35
+ refs[i].current.scrollIntoView({
36
+ behavior: "smooth",
37
+ block: "nearest",
38
+ inline: "start",
39
+ });
40
+ }
41
+ };
62
42
 
63
- refs[i].current.scrollIntoView({
64
- behavior: 'smooth',
65
- block: 'nearest',
66
- inline: 'start',
67
- });
68
- };
43
+ const totalCards = props.cards.length;
69
44
 
70
45
  const nextCard = () => {
71
-
72
- if (currentCard >= totalCards-1 || currentCard > totalClick+1) {
46
+ console.log(currentCard, totalCards)
47
+ if (currentCard >= totalCards-3) {
73
48
  scrollToCard(0);
74
49
  } else {
75
50
  scrollToCard(currentCard + 1);
@@ -83,38 +58,8 @@ export default function Carouseltest(props) {
83
58
  scrollToCard(currentCard - 1);
84
59
  }
85
60
  };
86
- const slider = () => {
87
-
88
- let x = visibleCardsContainerWidth;
89
- let noOfcardsinaview = visibleCardsContainerWidth/cardWidth;
90
-
91
- let y = 1;
92
-
93
- // if((noOfcardsinaview*(currentCard+1))<=totalCards){
94
- // let y = (totalContainerWidth/(noOfcardsinaview*visibleCardsContainerWidth))*(noOfcardsinaview*(currentCard+1));
95
-
96
- // }
97
-
98
- let slider1 = (384/(totalCards*cardWidth)) * (328)* (currentCard+noOfcardsinaview);
99
- if(slider1>384){
100
- slider1 = 384;
101
- }
102
- let roundOff = Math.floor(totalClick);
103
- let slider2 = 384/(roundOff+Math.floor(noOfcardsinaview)+1);
104
- let sliderWidth = 1;
105
- sliderWidth = (slider2 * (currentCard+1))+ 'px';
106
-
107
-
108
- return (
109
- <div className=' '>
110
- <div className='bg-pink-500 w-96 rounded-md content-center h-1'>
111
- <div className={`bg-blue-600 transition-all ease-in duration-300 rounded-md h-1 `} style={{ width: `${sliderWidth}` }} />
112
- </div>
113
- </div>
114
- )
115
- };
116
-
117
- const arrowStyle = ' text-2xl z-10 bg-black h-10 w-10 rounded-full bg-neutral-0 flex items-center justify-center';
61
+
62
+ const arrowStyle = ' text-2xl z-10 bg-black h-10 ml-6 w-10 rounded-full bg-purple-200 hover:bg-neutral-0 flex items-center justify-center';
118
63
 
119
64
  const sliderControl = isLeft => (
120
65
  <button
@@ -126,11 +71,11 @@ export default function Carouseltest(props) {
126
71
  <span role="img" aria-label={`Arrow ${isLeft ? 'left' : 'right'}`}>
127
72
  {isLeft ?
128
73
 
129
- <Icon height={'h-6 w-6'} variant={'chevronleft'} strokeColor='#1F2A37' />
74
+ <Icon height={'h-6 w-6'} variant={'chevronleft'} strokeColor='#00288E' />
130
75
 
131
76
  :
132
77
 
133
- <Icon height={'h-6 w-6'} variant={'chevronright'} strokeColor='#1F2A37' />
78
+ <Icon height={'h-6 w-6'} variant={'chevronright'} strokeColor='#00288E' />
134
79
 
135
80
  }
136
81
  </span>
@@ -149,9 +94,9 @@ export default function Carouseltest(props) {
149
94
  ))}
150
95
  </div>
151
96
 
152
- <div className="invisible flex flex-col-reverse tb:visible">
153
- <div className="flex items-center justify-around mt-20 ">
154
- {slider()}
97
+ <div className="hidden tb:flex tb:flex-col">
98
+ <div className="flex pb-12 items-center justify-end ">
99
+ {/* {slider()} */}
155
100
  <div className="flex">
156
101
  {sliderControl(true)}
157
102
  {sliderControl()}
@@ -1261,6 +1261,10 @@ select {
1261
1261
  margin-top: 2.25rem;
1262
1262
  }
1263
1263
 
1264
+ .ml-6 {
1265
+ margin-left: 1.5rem;
1266
+ }
1267
+
1264
1268
  .line-clamp-3 {
1265
1269
  overflow: hidden;
1266
1270
  display: -webkit-box;
@@ -1408,6 +1412,10 @@ select {
1408
1412
  max-height: 100%;
1409
1413
  }
1410
1414
 
1415
+ .min-h-\[96px\] {
1416
+ min-height: 96px;
1417
+ }
1418
+
1411
1419
  .w-1\/2 {
1412
1420
  width: 50%;
1413
1421
  }
@@ -1576,6 +1584,10 @@ select {
1576
1584
  min-width: 100%;
1577
1585
  }
1578
1586
 
1587
+ .min-w-\[100px\] {
1588
+ min-width: 100px;
1589
+ }
1590
+
1579
1591
  .max-w-2xl {
1580
1592
  max-width: 42rem;
1581
1593
  }
@@ -2072,6 +2084,10 @@ select {
2072
2084
  align-self: flex-end;
2073
2085
  }
2074
2086
 
2087
+ .self-center {
2088
+ align-self: center;
2089
+ }
2090
+
2075
2091
  .overflow-auto {
2076
2092
  overflow: auto;
2077
2093
  }
@@ -5362,6 +5378,11 @@ select {
5362
5378
  padding-bottom: 1.625rem;
5363
5379
  }
5364
5380
 
5381
+ .py-\[30px\] {
5382
+ padding-top: 30px;
5383
+ padding-bottom: 30px;
5384
+ }
5385
+
5365
5386
  .pb-10 {
5366
5387
  padding-bottom: 2.5rem;
5367
5388
  }
@@ -5502,6 +5523,10 @@ select {
5502
5523
  padding-left: 2rem;
5503
5524
  }
5504
5525
 
5526
+ .pb-12 {
5527
+ padding-bottom: 3rem;
5528
+ }
5529
+
5505
5530
  .text-left {
5506
5531
  text-align: left;
5507
5532
  }
@@ -7650,6 +7675,11 @@ select {
7650
7675
  background-color: rgb(243 244 246 / var(--tw-bg-opacity));
7651
7676
  }
7652
7677
 
7678
+ .hover\:bg-neutral-0:hover {
7679
+ --tw-bg-opacity: 1;
7680
+ background-color: rgb(255 255 255 / var(--tw-bg-opacity));
7681
+ }
7682
+
7653
7683
  .hover\:text-blue-600:hover {
7654
7684
  --tw-text-opacity: 1;
7655
7685
  color: rgb(30 86 227 / var(--tw-text-opacity));
@@ -8172,6 +8202,10 @@ select {
8172
8202
  max-width: 530px;
8173
8203
  }
8174
8204
 
8205
+ .tb\:max-w-\[289px\] {
8206
+ max-width: 289px;
8207
+ }
8208
+
8175
8209
  .tb\:grid-cols-2 {
8176
8210
  grid-template-columns: repeat(2, minmax(0, 1fr));
8177
8211
  }
@@ -8251,6 +8285,10 @@ select {
8251
8285
  padding: 4rem;
8252
8286
  }
8253
8287
 
8288
+ .tb\:p-0 {
8289
+ padding: 0px;
8290
+ }
8291
+
8254
8292
  .tb\:px-3 {
8255
8293
  padding-left: 0.75rem;
8256
8294
  padding-right: 0.75rem;
@@ -8755,6 +8793,16 @@ select {
8755
8793
  align-self: center;
8756
8794
  }
8757
8795
 
8796
+ .tb-l\:rounded-b-3xl {
8797
+ border-bottom-right-radius: 1.5rem;
8798
+ border-bottom-left-radius: 1.5rem;
8799
+ }
8800
+
8801
+ .tb-l\:rounded-r-2xl {
8802
+ border-top-right-radius: 1rem;
8803
+ border-bottom-right-radius: 1rem;
8804
+ }
8805
+
8758
8806
  .tb-l\:border-l {
8759
8807
  border-left-width: 1px;
8760
8808
  }