@platformatic/ui-components 0.1.56 → 0.1.57

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@platformatic/ui-components",
3
3
  "description": "Platformatic UI Components",
4
- "version": "0.1.56",
4
+ "version": "0.1.57",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -1,23 +1,56 @@
1
1
  import React from 'react'
2
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
3
- import { faCircleCheck } from '@fortawesome/free-regular-svg-icons'
2
+ import PropTypes from 'prop-types'
3
+ import PlatformaticIcon from './PlatformaticIcon'
4
4
  import styles from './ListElement.module.css'
5
- export default function List ({ title, detail }) {
5
+
6
+ function List ({ title, detail, marginSize, titleAspect }) {
7
+ let className = `${styles.container} `
8
+ className += styles[`margin-${marginSize}`]
9
+
10
+ let classNameTitle = `${styles.title} `
11
+ classNameTitle += styles[`${titleAspect}`]
12
+
6
13
  return (
7
- <div className={styles.container}>
8
- <div className={styles.iconCol}>
9
- <div data-testid='list-element-title-icon' className={styles.icon}>
10
- <FontAwesomeIcon icon={faCircleCheck} />
11
- </div>
12
- </div>
13
- <div className={styles.textCol}>
14
- <div className={styles.title} data-testid='list-element-title'>
14
+ <div className={className}>
15
+ <div className={styles.row}>
16
+ <PlatformaticIcon iconName='CircleCheckMarkIcon' color='green' data-testid='list-element-title-icon' onClick={null} />
17
+ <div className={classNameTitle} data-testid='list-element-title'>
15
18
  {title}
16
19
  </div>
17
- <div data-test-id='list-element-detail'>
18
- {detail}
19
- </div>
20
20
  </div>
21
+ {detail &&
22
+ (
23
+ <div className={styles.textCol} data-test-id='list-element-detail'>
24
+ {detail}
25
+ </div>
26
+ )}
21
27
  </div>
22
28
  )
23
29
  }
30
+ List.propTypes = {
31
+ /**
32
+ * title
33
+ */
34
+ title: PropTypes.string,
35
+ /**
36
+ * detail
37
+ */
38
+ detail: PropTypes.string,
39
+ /**
40
+ * marginSize
41
+ */
42
+ marginSize: PropTypes.oneOf(['small', 'medium']),
43
+ /**
44
+ * titleAspect
45
+ */
46
+ titleAspect: PropTypes.oneOf(['boldAndGreen', 'lightAndWhite'])
47
+ }
48
+
49
+ List.defaultProps = {
50
+ title: '',
51
+ detail: '',
52
+ marginSize: 'medium',
53
+ titleAspect: 'boldAndGreen'
54
+ }
55
+
56
+ export default List
@@ -1,21 +1,26 @@
1
1
  .container {
2
- @apply flex flex-row my-4
2
+ @apply flex flex-col my-4
3
3
  }
4
-
5
- .iconCol {
6
- @apply flex flex-col w-6
4
+ .margin-medium {
5
+ @apply my-4
7
6
  }
8
-
9
- .icon {
10
- @apply text-light-green
7
+ .margin-small {
8
+ @apply my-2
11
9
  }
12
-
13
10
  .title {
14
- @apply flex text-light-green font-bold w-full
11
+ @apply w-full;
12
+ }
13
+ .boldAndGreen {
14
+ @apply text-light-green font-bold;
15
+ }
16
+ .lightAndWhite {
17
+ @apply text-white font-light;
18
+ }
19
+ .row {
20
+ @apply flex gap-x-2 items-center w-full;
15
21
  }
16
-
17
22
  .textCol {
18
- @apply flex flex-col text-white text-justify w-full
23
+ @apply flex flex-col text-white text-justify w-full ml-6;
19
24
  }
20
25
 
21
26
  .detailSpace {
@@ -15,7 +15,7 @@ ListWithNoElements.args = {
15
15
 
16
16
  const TemplateWithElements = (args) => (
17
17
  <List {...args}>
18
- <ListElement title='List Element 1' detail='Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed et dui facilisis, molestie urna sed, volutpat nibh.' />
18
+ <ListElement title='List Element 1' detail='Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed et dui facilisis, molestie urna sed, volutpat nibh.' titleAspect='boldAndGreen' />
19
19
  <ListElement title='List Element 2' detail='Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed et dui facilisis, molestie urna sed, volutpat nibh.' />
20
20
  </List>
21
21
  )
@@ -27,3 +27,15 @@ ListWithElements.args = {
27
27
 
28
28
  export const ListWithElementsNoTitle = TemplateWithElements.bind({})
29
29
  ListWithElementsNoTitle.args = {}
30
+
31
+ const TemplateWithElementsVariants = (args) => (
32
+ <List {...args}>
33
+ <ListElement title='List Element 1' titleAspect='boldAndGreen' marginSize='small' />
34
+ <ListElement title='List Element 2' titleAspect='lightAndWhite' marginSize='small' />
35
+ </List>
36
+ )
37
+
38
+ export const ListWithElementsVariants = TemplateWithElementsVariants.bind({})
39
+ ListWithElementsVariants.args = {
40
+ title: 'List Title'
41
+ }