hds-web 1.3.0 → 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.0",
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
 
@@ -3,6 +3,7 @@ import { useState } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { Icon } from '../common-components/Icon';
5
5
  import {Typography} from '../../foundation/Typography'
6
+ import { HDSColor } from '../../foundation/ColorPalette';
6
7
  const sizeClasses = {
7
8
  sm: 'py-0.5 px-2 hds-d-body3c',
8
9
  default: 'py-1 px-3',
@@ -27,8 +28,10 @@ const colorVariants = {
27
28
  export default function Badge({
28
29
  leftIconVariant,
29
30
  leftIconColor,
31
+ leftIconColorClass,
30
32
  rightIconVariant,
31
33
  rightIconColor,
34
+ rightIconColorClass,
32
35
  size,
33
36
  children,
34
37
  color,
@@ -44,7 +47,7 @@ export default function Badge({
44
47
 
45
48
  return (
46
49
  <button
47
- className={`${sizeClasses[size]} ${
50
+ className={` cursor-default ${sizeClasses[size]} ${
48
51
  colorVariants[color]
49
52
  } inline-flex items-center rounded-full`}
50
53
  onClick={handleClick}
@@ -52,14 +55,14 @@ export default function Badge({
52
55
  >
53
56
  {leftIconVariant && leftIconVariant !== 'none' && (
54
57
  <div className='mr-1'>
55
- <Icon height={'h-4 w-4'} variant={leftIconVariant} strokeColor={leftIconColor} />
58
+ <Icon height={'h-4 w-4'} variant={leftIconVariant} strokeColor={leftIconColor} strokeClass={HDSColor(leftIconColorClass)} />
56
59
  </div>
57
60
  )}
58
61
  <Typography textStyle='body3c-medium'>{children}</Typography>
59
62
 
60
63
  {rightIconVariant && rightIconVariant !== 'none' && (
61
64
  <div className='ml-1'>
62
- <Icon height={'h-4'} variant={rightIconVariant} strokeColor={rightIconColor} />
65
+ <Icon height={'h-4'} variant={rightIconVariant} strokeColor={rightIconColor} rightIconColorClass={HDSColor(rightIconColorClass)} />
63
66
  </div>
64
67
  )}
65
68
  </button>
@@ -1,2 +1,3 @@
1
1
  export {default as TalkCard} from './talkCard';
2
+ export {default as TalkCard2} from './talkcard2';
2
3
  export {default as IconCard} from './iconCard';
@@ -29,11 +29,9 @@ export default function TalkCard(props) {
29
29
 
30
30
  {props.para &&
31
31
  <Typography
32
- className='line-clamp-3 text-neutral-700 [&>p]:pb-2 last:[&>p]:pb-0 [&>ul]:ps-4 [&>ul>li]:list-disc [&>ul>li]:pb-2 [&>ul>li]:last:pb-0'
33
- textStyle='body1'>
34
- <ReactMarkdown>
32
+ className='line-clamp-3 text-neutral-700'
33
+ textStyle='body1c'>
35
34
  {props.para}
36
- </ReactMarkdown>
37
35
  </Typography>}
38
36
 
39
37
  </div>
@@ -0,0 +1,112 @@
1
+ import React from "react";
2
+ import { Badges } from '../../BadgesCaption';
3
+ import { Typography } from '../../../foundation/Typography'
4
+ import { ProfileAvatar } from '../../Avatars'
5
+ import { Time } from "../../../helpers/Time";
6
+ import { HDSButton } from '../../Buttons'
7
+ import ReactMarkdown from "react-markdown";
8
+
9
+ export default function TalkCard2(props) {
10
+ let CardClass = ''
11
+ if (props.speakerSet === undefined) {
12
+ CardClass = 'tb-l:justify-center';
13
+ }
14
+ else CardClass = 'tb-l:justify-between';
15
+
16
+ return (
17
+
18
+ <div className="grid">
19
+ <div className={`flex flex-col tb-l:flex-row tb-l:justify-between `}>
20
+ <div className={"px-8 py-6 tb-l:border-r tb-l:border-r-neutral-200"}>
21
+ <div className="flex gap-2">
22
+ {props.badges &&
23
+ props.badges.map((value, index) => (
24
+ <div key={index} className='flex whitespace-nowrap'>
25
+ <Badges
26
+ size={value.size}
27
+ color={value.color}
28
+ leftIconVariant={value.leftIconVariant}
29
+ leftIconColor={value.leftIconColor}
30
+ leftIconColorClass={value.leftIconColorClass}
31
+ children={value.label}
32
+
33
+ />
34
+ </div>
35
+ ))
36
+ }
37
+
38
+ </div>
39
+ <div className="tb-l:w-[520px]">
40
+
41
+ <Typography className='my-2 text-blue-800' textStyle='h5'>{props.title}</Typography>
42
+
43
+ {props.para &&
44
+ <Typography
45
+ className='line-clamp-3 text-neutral-700'
46
+ textStyle='body1c'>
47
+ {props.para}
48
+ </Typography>
49
+ }
50
+ {props.readUrl && (
51
+ <a href={props.readUrl}>
52
+ <HDSButton
53
+ label='Read more'
54
+ type='secondaryLink'
55
+ leftIconVariant='none'
56
+ rightIconVariant='none'
57
+ state='default'
58
+ size='md'
59
+ rightAnimatedArrow={true}
60
+ rightAnimatedArrowColor='#3970FD'
61
+ className='mt-4'
62
+ btnTextColorClass='text-blue-500'
63
+ animatedHoverStroke='stroke-blue-500'
64
+ />
65
+ </a>
66
+ )}
67
+
68
+
69
+ </div>
70
+
71
+ </div>
72
+
73
+ <div className={`${CardClass} divide-y divide-neutral-150 flex tb-l:w-full flex-col pt-0`} >
74
+ {
75
+ props.speakerSet && (
76
+ <div className="pl-8 flex gap-6 tb-l:pt-12 tb:mt-0 tb-l:pb-12 pb-6 flex-col ">
77
+ {props.speakerSet.map((value, i) => (
78
+ <div key={i} className="block">
79
+
80
+ <ProfileAvatar
81
+ name={value.name}
82
+ size='md'
83
+ designation={value.designation}
84
+ imageUrl={value.imageUrl}
85
+ />
86
+ </div>
87
+
88
+ ))}
89
+ </div>
90
+ )
91
+ }
92
+ {props.eventTime && <div className=" w-full pl-8 p-6 flex flex-row justify-between items-center">
93
+ <Typography textStyle='h6' className='text-blue-800'>{props.eventTime}</Typography>
94
+ <a href={props.addCalendarUrl}>
95
+ <HDSButton
96
+ leftIconVariant='calendarplus02'
97
+ leftIconColor="#1E56E3"
98
+ rightIconVariant='none'
99
+ state='default'
100
+ size='sm'
101
+ type="iconOnly"
102
+ label=''
103
+ />
104
+ </a>
105
+ </div>}
106
+ </div>
107
+ </div>
108
+ </div>
109
+
110
+ )
111
+
112
+ }
@@ -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()}