hds-web 1.0.1 → 1.0.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.0.1",
3
+ "version": "1.0.2",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -7,23 +7,29 @@ const imgSizes = {
7
7
  'md': 'h-12 w-12',
8
8
  'lg': 'h-[60px] w-[60px]',
9
9
  }
10
+ const AvatarVariant = {
11
+ 'circular': 'shadow rounded-full border-[1.5px] border-neutral-0',
12
+ 'square': 'rounded-lg',
13
+ }
14
+
10
15
 
11
16
  const nameTextStyle = {
12
- 'xs': 'text-sm-medium',
13
- 'sm': 'text-sm-medium',
14
- 'md': 'text-md-medium',
15
- 'lg': 'text-lg-medium'
17
+ 'xs': 'text-d-body1c-bold',
18
+ 'sm': 'text-d-body1c-bold',
19
+ 'md': 'text-d-body1c-bold',
20
+ 'lg': 'text-d-body1c-bold'
16
21
  }
17
22
 
18
23
  const desgnTextStyle = {
19
- 'xs': 'text-xs-regular',
20
- 'sm': 'text-sm-regular',
21
- 'md': 'text-md-regular',
22
- 'lg': 'text-md-regular'
24
+ 'xs': 'text-hds-d-body3c ',
25
+ 'sm': 'text-hds-d-body3c ',
26
+ 'md': 'text-hds-d-body3c ',
27
+ 'lg': 'text-hds-d-body3c '
23
28
  }
24
29
 
25
- export default function ProfileAvatar({ name, designation, size, imageUrl }) {
26
- const imgSizeClass = imgSizes[size] || imgSizes.medium;
30
+ export default function ProfileAvatar({ name, designation, size, imageUrl, avatarVariant }) {
31
+ const imgSizeClass = imgSizes[size] || imgSizes.md;
32
+ const avatarVariantClass = AvatarVariant[avatarVariant] || AvatarVariant.circular;
27
33
  const defaultAvatarIcon = "user03";
28
34
  const hasImageUrl = imageUrl && imageUrl.length > 0;
29
35
  return (
@@ -32,9 +38,8 @@ export default function ProfileAvatar({ name, designation, size, imageUrl }) {
32
38
  <div>
33
39
  {hasImageUrl ? (
34
40
  <img
35
- className={`${imgSizeClass} inline-block shadow rounded-full border-[1.5px] border-neutral-0`}
41
+ className={`${imgSizeClass} ${avatarVariantClass} rounded inline-block`}
36
42
  src={imageUrl}
37
-
38
43
  />
39
44
  ) : (
40
45
  <Icon
@@ -45,8 +50,15 @@ export default function ProfileAvatar({ name, designation, size, imageUrl }) {
45
50
  )}
46
51
  </div>
47
52
  <div className="ml-3">
48
- <p className={`${nameTextStyle[`${size}`]} text-neutral-900 group-hover:text-gray-900`}>{name}</p>
49
- <p className={`${desgnTextStyle[`${size}`]} text-neutral-500 group-hover:text-gray-700`}>{designation}</p>
53
+ <p
54
+ className={`${nameTextStyle[`${size}`]}text-neutral-900 group-hover:text-gray-900`}
55
+ >
56
+ {name}
57
+ </p>
58
+ <p
59
+ className={`${desgnTextStyle[`${size}`]} text-neutral-500 group-hover:text-gray-700`}>
60
+ {designation}
61
+ </p>
50
62
  </div>
51
63
  </div>
52
64
  </a>
@@ -93,7 +93,12 @@ const Buttonclasses = {
93
93
  'sm': 'rounded-full',
94
94
  'md': 'rounded-full p-2.5',
95
95
  'lg': 'trounded-full p-3'
96
- }
96
+ },
97
+ 'links': {
98
+ 'sm': 'text-hds-d-body3c-medium rounded-full',
99
+ 'md': 'text-hds-d-body3c-medium rounded-full',
100
+ 'lg': 'text-hds-d-body1c-medium rounded-full'
101
+ },
97
102
  }
98
103
  }
99
104
  export default function Button(props) {
@@ -126,6 +131,7 @@ export default function Button(props) {
126
131
 
127
132
  let sizeType = 'default';
128
133
  if(type=='iconOnly'){sizeType='iconOnly'}
134
+ if(type=='secondaryLink' || type=='primaryLink' ){sizeType='links'}
129
135
 
130
136
 
131
137
  const buttonClasses = [
@@ -190,12 +196,17 @@ Button.propTypes = {
190
196
  };
191
197
 
192
198
  Button.defaultProps = {
193
- size: 'sm',
199
+ size: 'md',
194
200
  type: 'primary',
195
- leftIconVariant: 'home03',
201
+ leftIconVariant: 'none',
196
202
  rightIconVariant: 'home3',
197
- rightIconColor: '#80ff00',
198
- leftIconColor: '#80ff00',
199
- animatedHoverStroke:''
200
-
203
+ rightIconColor: '#FFFFFF',
204
+ leftIconColor: '#FFFFFF',
205
+ animatedHoverStroke:'#FFFFFF',
206
+ state: 'default',
207
+ label: 'Button',
208
+ rightAnimatedArrow: 'True' ,
209
+ rightAnimatedArrowColor: '#FFFFFF',
210
+ animatedHoverStroke: 'group-hover:stroke-neutral-0',
211
+
201
212
  };
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import {HDSColor} from '../../../foundation/ColorPalette'
3
+ import { ProfileAvatar } from '../../Avatars'
4
+ import { Typography } from '../../../foundation/Typography'
5
+
6
+
7
+ export default function FeedbackCard(props) {
8
+ return (
9
+ <div className='bg-neutral-0 rounded-3xl shadow p-6 tb-l:p-10'>
10
+ <div className='pb-8'>
11
+ <img src={props.brandImgUrl} alt={props.brandImgAlt} />
12
+ </div>
13
+ <div className="pb-10">
14
+ <Typography textStyle="quote" className='text-neutral-1000'>{props.description}</Typography>
15
+ </div>
16
+ <ProfileAvatar
17
+ name={props.speakerName}
18
+ size='md'
19
+ designation={props.speakerDesignation}
20
+ imageUrl={props.speakerImgUrl}
21
+ avatarVariant="square"
22
+ />
23
+ </div>
24
+ )
25
+ }
@@ -0,0 +1 @@
1
+ export {default as FeedbackCard} from './feedback';
@@ -0,0 +1,2 @@
1
+ export {default as LinkCard} from './link';
2
+ export {default as ResourcesCard} from './resources';
@@ -0,0 +1,86 @@
1
+ import React from "react";
2
+ import PropTypes from 'prop-types';
3
+ import { Icon } from "../../common-components/Icon";
4
+ import { HDSColor } from '../../../foundation/ColorPalette'
5
+ import { Typography } from '../../../foundation/Typography'
6
+
7
+
8
+ export default function LinkCard(props) {
9
+ const iconStrokeColor = HDSColor(props.iconStrokeColor);
10
+ const cardBgColorClass = HDSColor(props.cardBgColor)
11
+ const cardHoverClasses = `hover:${HDSColor(props.cardHoverBg)}` + ' hover:shadow-xl';
12
+ return (
13
+ <>
14
+ <a
15
+ href={props.linkUrl}
16
+ className={`${cardHoverClasses} ${cardBgColorClass} min-w-[15rem] rounded-2xl border border-neutral-150 p-6 block`}
17
+ >
18
+ {props.brandImageUrl ?
19
+ (
20
+ <div className="flex flex-col">
21
+ <div className="flex justify-end items-end pr-6">
22
+ {props.iconArrowVariant &&
23
+ (<Icon
24
+ height={'w-6 h-6 stroke-[1.5px] stroke-blue-400'}
25
+ variant={props.iconArrowVariant}
26
+ strokeColor={props.iconArrowStrokeColor}
27
+ />)
28
+ }
29
+ </div>
30
+ <img src={props.brandImageUrl} alt={props.brandImageAlt} />
31
+
32
+ </div>
33
+ )
34
+ :
35
+ (
36
+ <>
37
+ <div className='flex items-center'>
38
+ <div className='flex items-center flex-1'>
39
+ {props.iconVariant &&
40
+ (<Icon
41
+ height={'w-6 h-6 mr-2 stroke-[1.5px] '}
42
+ variant={props.iconVariant}
43
+ strokeColor={iconStrokeColor}
44
+ />)}
45
+ <Typography
46
+ as="h5"
47
+ textStyle="body1c-bold"
48
+ className="text-neutral-1000">
49
+ {props.title}
50
+ </Typography>
51
+ </div>
52
+ {props.iconArrowVariant &&
53
+ (<Icon
54
+ height={'w-6 h-6 stroke-[1.5px] stroke-blue-400'}
55
+ variant={props.iconArrowVariant}
56
+ strokeColor={props.iconArrowStrokeColor}
57
+ />)
58
+ }
59
+ </div>
60
+ {props.description &&
61
+ (<Typography
62
+ textStyle="body3"
63
+ className="text-neutral-1000 mt-2">
64
+ {props.description}
65
+ </Typography>)}
66
+ </>
67
+ )
68
+ }
69
+ </a>
70
+ </>
71
+ )
72
+ }
73
+
74
+ LinkCard.defaultProps = {
75
+ brandImageUrl: '',
76
+ brandImageAlt:'',
77
+ linkUrl: '#',
78
+ cardBgColor: 'bg-neutral-0',
79
+ cardHoverBg: 'bg-neutral-0',
80
+ iconVariant: 'videorecorder',
81
+ iconStrokeColor: 'blue-500',
82
+ iconArrowVariant: 'arrownarrowupright',
83
+ iconArrowStrokeColor: 'blue-400',
84
+ title: 'Webinar',
85
+ description: 'Model Level Authorization System for GraphQL with Hasura',
86
+ };
@@ -0,0 +1,53 @@
1
+ import React from "react";
2
+ import { Icon } from "../../common-components/Icon";
3
+ import { HDSColor } from '../../../foundation/ColorPalette';
4
+ import { Typography } from '../../../foundation/Typography';
5
+ import PropTypes from 'prop-types';
6
+
7
+
8
+ export default function ResourcesCard(props) {
9
+ const iconBG = HDSColor(props.iconBg);
10
+ console.log(props.resourcesArr);
11
+ return (
12
+ <>
13
+ <div className={`p-8 ${props.cardBg} min-w-[18rem] rounded-3xl`}>
14
+
15
+ {props.title && (
16
+ <Typography
17
+ textStyle='h6'
18
+ className={`uppercase ${props.title_text_color}`}>
19
+ {props.title}
20
+ </Typography>
21
+ )}
22
+ <div className="mt-6">
23
+ {props.resourcesArr.map((value) => (
24
+ <a href={value.cta_linkUrl} className="flex gap-2 mt-4">
25
+ <Icon
26
+ height={'w-6 h-6 mr-2 stroke-[1.5px] stroke-blue-600'}
27
+ variant={value.cta_icon}
28
+ strokeClass={value.cta_stroke}
29
+ />
30
+ <Typography
31
+ textStyle='body2c'
32
+ className={value.cta_text_color}>
33
+ {value.cta_text}
34
+ </Typography>
35
+ </a>
36
+ ))}
37
+ </div>
38
+ </div>
39
+ </>
40
+ )
41
+ }
42
+ ResourcesCard.defaultProps = {
43
+ cardBg: 'bg-neutral-0',
44
+ title: 'Resources Card',
45
+ title_text_color: 'text-blue-600',
46
+ resourcesArr: [
47
+ { cta_text: 'This is one really long link that may spill onto the next line', cta_icon: 'linkexternal01', cta_text_color: 'text-neutral-700 hover:text-blue-600 ', cta_stroke: 'stroke-blue-600', cta_linkUrl: '#' },
48
+ { cta_text: 'This is a regular link that fits in one line', cta_text_color: 'text-neutral-700', cta_icon: 'linkexternal01', cta_stroke: 'stroke-blue-600', cta_linkUrl: '#' },
49
+ { cta_text: 'text3', cta_text_color: 'text-neutral-700', cta_icon: 'linkexternal01', cta_stroke: 'stroke-blue-600', cta_linkUrl: '#' },
50
+ { cta_text: 'text4', cta_text_color: 'text-neutral-700', cta_icon: 'linkexternal01', cta_stroke: 'stroke-blue-600', cta_linkUrl: '#' },
51
+
52
+ ]
53
+ }
@@ -34,6 +34,7 @@ export default function FlyoutB(props) {
34
34
  size='sm'
35
35
  rightAnimatedArrow={true}
36
36
  rightAnimatedArrowColor='#6C737F'
37
+ className='mt-4'
37
38
  />
38
39
  </div>
39
40
  <Typography className='mt-2 text-neutral-800' textStyle='body3'>{mainDescription}</Typography>
@@ -0,0 +1 @@
1
+ export {default as TalkDetailCard} from './talkDetailCard';
@@ -0,0 +1,68 @@
1
+ import React from "react";
2
+ import PropTypes from 'prop-types';
3
+ import {HDSColor} from '../../../foundation/ColorPalette';
4
+ import { Badges } from '../../BadgesCaption';
5
+ import { ProfileAvatar } from '../../Avatars'
6
+ import { Typography } from "../../../foundation/Typography";
7
+
8
+
9
+ export default function TalkDetailCard(props) {
10
+ const badgeLeftIconColor = HDSColor(props.badgeLeftIconColor);
11
+ return (
12
+ <div>
13
+ <Badges
14
+ color={props.badgeColor}
15
+ leftIconColor={badgeLeftIconColor}
16
+ leftIconVariant='home03'
17
+ size='default'
18
+ >
19
+ {props.talk_type}
20
+ </Badges>
21
+ <Typography textStyle='h6' className='text-blue-600 uppercase pt-4 pb-2'>{props.tag_line}</Typography>
22
+ <Typography textStyle='h3' as='h3' className='text-blue-900 pb-4'>{props.title}</Typography>
23
+ {
24
+ props.social_share && (
25
+ <div className='flex items-center pb-14'>
26
+ {
27
+ props.social_share.map((socialShare, i) => (
28
+ <div className='mx-2 first:ml-0 last:mr-0'>
29
+ <img src={socialShare.img_url} alt={socialShare.img_alt} />
30
+ </div>
31
+ ))
32
+ }
33
+ </div>
34
+ )
35
+ }
36
+ {
37
+ props.speaker_card && (
38
+ <div>
39
+ <Typography textStyle='h6' as='h6' className='uppercase text-neutral-500 pb-6'>speakers</Typography>
40
+ {
41
+ props.speaker_card.map((speaker, i) => (
42
+ <div className='pb-4 last:pb-0'>
43
+ <ProfileAvatar
44
+ name={speaker.name}
45
+ size='md'
46
+ designation={speaker.designation}
47
+ imageUrl={speaker.speakerImgUrl}
48
+ avatarVariant="circle"
49
+ />
50
+ </div>
51
+ ))
52
+ }
53
+ </div>
54
+ )
55
+ }
56
+ </div>
57
+ )
58
+ }
59
+
60
+ TalkDetailCard.defaultProps = {
61
+ badgeColor: 'green',
62
+ badgeLeftIconColor: 'stroke-neutral-0',
63
+ talk_type: 'Talk',
64
+ tag_line: 'June 20-22, 2023 | VIRTUAL | Free',
65
+ title: 'Deploying Hasura apps the fast way with the new Vercel integration',
66
+ social_share: '',
67
+ speaker_card: '',
68
+ };
@@ -0,0 +1,198 @@
1
+ import { useState, useEffect } from "react";
2
+ import { Typography } from "../../foundation/Typography";
3
+ import { HDSButton } from "../Buttons";
4
+ import { HDSColor } from "../../foundation/ColorPalette";
5
+ import { Icon } from "../common-components";
6
+ import { LinkCard } from '../Cards/Link';
7
+ import { v4 as uuidv4 } from 'uuid';
8
+
9
+ export default function HeroSecondary({ heroData, logo, scrollArrow, fontSize }) {
10
+ const [valumeMuteIcon, setValumeMuteIcon] = useState("volumex");
11
+ const videoMute = () => {
12
+ if (heroData.video_url) {
13
+ const videoEle = document.getElementById("hero_vid");
14
+ if (videoEle?.muted) {
15
+ videoEle.muted = false;
16
+ setValumeMuteIcon("volumemax")
17
+ } else {
18
+ videoEle.muted = true;
19
+ setValumeMuteIcon("volumex")
20
+ }
21
+ }
22
+ }
23
+
24
+ const videoComponent = (heroData) => (
25
+ heroData.video_url ? (
26
+ <div className={"relative" + ((heroData.video_gradient_bg) ? "" : " p-4")}>
27
+ <div className="w-12 h-12 bg-neutral-0 rounded-full absolute right-8 bottom-8 shadow-md cursor-pointer z-[2] flex items-center justify-center" onClick={() => videoMute()}>
28
+ <Icon height={'w-6 h-6 stroke-neutral-800 stroke-[1.5px]'} variant={valumeMuteIcon} strokeColor="#1F2A37" />
29
+ </div>
30
+ <video
31
+ id="hero_vid"
32
+ controls={false}
33
+ // autoPlay
34
+ loop
35
+ muted
36
+ poster="https://res.cloudinary.com/dh8fp23nd/image/upload/v1683015500/hasura-con-2023/engage_clgotb.png"
37
+ className={"tb:w-full w-full " + ((heroData.video_gradient_bg) ? "" : " rounded-xl shadow-md")}
38
+ >
39
+ <source
40
+ src={heroData.video_url}
41
+ type="video/mp4"
42
+ />
43
+ </video>
44
+ {
45
+ heroData.video_gradient_bg && (<div className={`tb-l:w-1/2 w-full h-1/2 tb:h-full absolute left-0 top-0 tb-l:ml-[-4px] tb-l:bg-gradient-to-r ${videoGradientBg} to-transparent bg-gradient-to-b tb:mt-[-4px] tb-l:mt-0`}></div>)
46
+ }
47
+ </div>
48
+ ) : (
49
+ <div className="w-full"
50
+ variants={{
51
+ hidden: {
52
+ opacity: 0,
53
+ },
54
+ visible: {
55
+ opacity: 1,
56
+ transition: {
57
+ delay: .2,
58
+ duration: 1,
59
+ }
60
+ },
61
+ }}
62
+ >
63
+ {heroData.img_url && (
64
+ <div className="text-right pt-0 flex items-end justify-end h-full">
65
+ <img
66
+ src={heroData.img_url}
67
+ alt="Hero"
68
+ className="db:inline tb:w-[90%] tb-l:w-[70%] db:w-[75%] w-full rounded-b-3xl"
69
+ />
70
+ </div>
71
+ )}
72
+ </div>
73
+ )
74
+ )
75
+
76
+ const title = () => (
77
+ heroData.title && (
78
+ <div
79
+
80
+ >
81
+ {
82
+ logo ? (
83
+ <div className={"pb-4 db:text-left text-center tb-l:text-left" + ((heroData.video_url) ? " tb:text-center" : " tb:text-left")}>
84
+ <img className="w-[290px] inline-block" src={logo} alt="Brand" />
85
+ </div>
86
+ ) : (
87
+ <Typography textStyle={fontSize ? fontSize : "h1"} as="h1" className={"pb-2 text-center break-words db:text-left tb-l:text-left " + ((heroData.title_color) ? heroData.title_color : "") + ((heroData.video_url) ? " tb:text-center" : " tb:text-left")}>{heroData.title}</Typography>
88
+ )
89
+ }
90
+ </div>
91
+ )
92
+ )
93
+
94
+ const heroButton = () => (
95
+ heroData.buttons && (
96
+ <div className={" gap-2 flex items-center justify-center tb-l:justify-start db:justify-start pt-6" + ((heroData.video_url) ? " tb:justify-center" : " tb:justify-start")}>
97
+ {
98
+ heroData.buttons.map((btn, index) => (
99
+ <HDSButton
100
+ leftIconVariant='none'
101
+ rightIconVariant='none'
102
+ label={btn.cta_text}
103
+ state='default'
104
+ size='lg'
105
+ rightAnimatedArrow='true'
106
+ rightAnimatedArrowColor='#ffffff'
107
+ />
108
+ ))
109
+ }
110
+ </div>
111
+ )
112
+ )
113
+
114
+ const LinkCardsFn = (heroData) => {
115
+ return (
116
+ heroData.linkCards && (
117
+ <div className="flex mt-16 px-20 pb-20 gap-6 justify-center">
118
+ {heroData.linkCards.map((card) => (
119
+ <div key={uuidv4()} className="w-full">
120
+ <LinkCard
121
+ linkUrl={card.linkUrl}
122
+ cardBgColor={card.cardBgColor}
123
+ cardHoverBg={card.cardHoverBg}
124
+ iconVariant={card.iconVariant}
125
+ iconStrokeColor={card.iconStrokeColor}
126
+ iconArrowVariant={card.iconArrowVariant}
127
+ iconArrowStrokeColor={card.iconArrowStrokeColor}
128
+ title={card.title}
129
+ description={card.description}
130
+ />
131
+ </div>
132
+ ))}
133
+ </div>
134
+ )
135
+ );
136
+ };
137
+
138
+ const imageCard = (heroData) => (
139
+ heroData.imageUrl && (
140
+ <div className="px-20 py-20">
141
+ <img src={heroData.imageUrl} alt={heroData.imageAlt} />
142
+ </div>
143
+ )
144
+ )
145
+
146
+ const videoGradientBg = HDSColor(heroData.video_gradient_bg);
147
+ return (
148
+ <div className="db:pt-32 mb-10 db:mb-5 tb:mb-16 tb-l:mb-0">
149
+ <div className="tb:px-4">
150
+ <div className={"max-w-7xl mx-auto rounded-3xl overflow-hidden " + ((heroData.bg_color) ? heroData.bg_color : "")} >
151
+ <div className="w-full">
152
+ <div className={"db:flex db:w-full tb-l:flex block" + ((heroData.video_url) ? " tb:block" : " tb:flex")}>
153
+ <div className={"db:px-20 db:py-20 db:pr-0 tb-l:self-center tb-l:min-w-[400px] mx-auto db:ml-0 db:max-w-[625px] db:min-w-[625px] p-5 pt-10 z-[1] tb:p-16 tb-l:py-12" + ((heroData.video_url) ? " tb:max-w-[530px]" : " tb:ml-0 tb:max-w-[290px] tb:min-w-[310px] tb:pr-0")}
154
+ >
155
+ {
156
+ heroData.tag_line && (
157
+ <div
158
+ >
159
+ <Typography textStyle="h6" as="h6" className={"pb-2 uppercase text-center db:text-left font-normal tb-l:text-left " + ((heroData.tag_line_color) ? heroData.tag_line_color : "") + ((heroData.video_url) ? " tb:text-center" : " tb:text-left")}
160
+ >
161
+ {heroData.tag_line}
162
+ </Typography>
163
+ </div>
164
+ )
165
+ }
166
+ {title(heroData)}
167
+ {
168
+ heroData.sub_title && (
169
+ <Typography textStyle="sub1" className={"text-center db:text-left tb-l:text-left " + ((heroData.sub_title_color) ? heroData.sub_title_color : "") + ((heroData.video_url) ? " tb:text-center" : " tb:text-left")}>{heroData.sub_title}</Typography>
170
+ )
171
+ }
172
+
173
+ {
174
+ heroData.description && (
175
+ <Typography textStyle="sub2" className="text-center tb:text-left db:text-left tb-l:text-left text-blue-700 [&>*]:mb-8 last:[&>*]:mb-0">{heroData.description}</Typography>
176
+ )
177
+ }
178
+ {heroButton(heroData)}
179
+
180
+
181
+ </div>
182
+ {imageCard(heroData)}
183
+ </div>
184
+
185
+ {LinkCardsFn(heroData)}
186
+
187
+ </div>
188
+ </div>
189
+ {
190
+ scrollArrow && (
191
+ <>
192
+ </>
193
+ )
194
+ }
195
+ </div>
196
+ </div>
197
+ );
198
+ }
@@ -1 +1,2 @@
1
- export {default as Hero1} from './h1'
1
+ export {default as Hero1} from './h1'
2
+ export {default as HeroSecondary} from './h2'
@@ -1 +1,2 @@
1
- export {default as TableA} from './tableA';
1
+ export {default as TableA} from './tableA';
2
+ export {default as TableB} from './tableB';
@@ -0,0 +1,86 @@
1
+ import React from 'react';
2
+ import { v4 as uuidv4 } from 'uuid';
3
+ import { Typography } from '../../foundation/Typography'
4
+
5
+ const test = (TABLE_HEADER) => (
6
+ console.log(TABLE_HEADER[0]['title']),
7
+ Object.keys(TABLE_HEADER[0]).map((key, value) => (
8
+
9
+ <th
10
+ key={key}
11
+ scope="col"
12
+ className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell"
13
+ >
14
+ {key}
15
+ </th>
16
+ ))
17
+ )
18
+
19
+ export default function TableB(props) {
20
+ const {
21
+ title,
22
+ description,
23
+ TABLE_VALUE,
24
+ TABLE_HEADER,
25
+ children
26
+
27
+ } = props;
28
+ test(TABLE_HEADER);
29
+ return (
30
+ <div className="px-4 sm:px-6 lg:px-8 ">
31
+ <div className="sm:flex sm:items-center ">
32
+ <div className="sm:flex-auto flex flex-col items-center">
33
+ {title && (
34
+ <Typography
35
+ textStyle='h2'>
36
+ {title}
37
+ </Typography>
38
+ )
39
+ }
40
+ {description && (
41
+ <Typography
42
+ textStyle='body1c'>
43
+ {description}
44
+ </Typography>
45
+ )
46
+ }
47
+ </div>
48
+ </div>
49
+
50
+ <div>
51
+ <div className="-mx-4 mt-8 sm:-mx-0">
52
+ <table className="min-w-full divide-y divide-gray-300 border">
53
+ <thead>
54
+ <tr>
55
+ {Object.keys(TABLE_HEADER[0]).map((key, value) => (
56
+ <th
57
+ key={key}
58
+ scope="col"
59
+ className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900 sm:table-cell"
60
+ >
61
+ {}
62
+ </th>
63
+ ))}
64
+ </tr>
65
+ </thead>
66
+ <tbody className="divide-y divide-gray-200 bg-white">
67
+ {TABLE_VALUE.map((value) => (
68
+ <tr key={uuidv4()}>
69
+ {Object.keys(value).map((key) => (
70
+ <td
71
+ key={uuidv4()}
72
+ className=" py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-3"
73
+ >
74
+ {``}{value[key]}
75
+
76
+ </td>
77
+ ))}
78
+ </tr>
79
+ ))}
80
+ </tbody>
81
+ </table>
82
+ </div>
83
+ </div>
84
+ </div>
85
+ )
86
+ }