@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,23 +1,56 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import PlatformaticIcon from './PlatformaticIcon'
|
|
4
4
|
import styles from './ListElement.module.css'
|
|
5
|
-
|
|
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={
|
|
8
|
-
<div className={styles.
|
|
9
|
-
<
|
|
10
|
-
|
|
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-
|
|
2
|
+
@apply flex flex-col my-4
|
|
3
3
|
}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
@apply flex flex-col w-6
|
|
4
|
+
.margin-medium {
|
|
5
|
+
@apply my-4
|
|
7
6
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@apply text-light-green
|
|
7
|
+
.margin-small {
|
|
8
|
+
@apply my-2
|
|
11
9
|
}
|
|
12
|
-
|
|
13
10
|
.title {
|
|
14
|
-
@apply
|
|
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
|
+
}
|