@platformatic/ui-components 0.1.8 → 0.1.9
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 +1 -1
- package/src/components/ApiSummary.jsx +1 -1
- package/src/components/Main.jsx +1 -1
- package/src/components/PullRequest.jsx +36 -0
- package/src/components/PullRequest.module.css +18 -0
- package/src/components/SearchBar.jsx +13 -5
- package/src/components/TabbedWindow.jsx +1 -1
- package/src/components/TabbedWindow.module.css +8 -1
- package/src/components/{Api → icons}/ApiIcon.jsx +0 -0
- package/src/components/{Api → icons}/ApiIconClosed.jsx +0 -0
- package/src/components/icons/PullRequestIcon.jsx +31 -0
- package/src/components/layouts/Layout.jsx +1 -1
- package/src/stories/PullRequest.stories.jsx +23 -0
- package/src/stories/SearchBar.stories.jsx +26 -0
- package/src/components/Pr.jsx +0 -9
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import ApiFooter from './Api/Footer'
|
|
|
4
4
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
|
5
5
|
import { faLink } from '@fortawesome/free-solid-svg-icons'
|
|
6
6
|
import ApiVersion from './Api/Version'
|
|
7
|
-
import ApiIcon from './
|
|
7
|
+
import ApiIcon from './icons/ApiIcon'
|
|
8
8
|
import ApiIconClosed from './Api/ApiIconClosed'
|
|
9
9
|
import Separator from './VerticalSeparator'
|
|
10
10
|
import ApiStatus from './Api/Status'
|
package/src/components/Main.jsx
CHANGED
|
@@ -4,7 +4,7 @@ import SearchBar from './SearchBar'
|
|
|
4
4
|
import Api from './Api'
|
|
5
5
|
import ApiDetails from './ApiDetail'
|
|
6
6
|
import TabbedWindow from './TabbedWindow'
|
|
7
|
-
import Prs from './
|
|
7
|
+
import Prs from './PullRequest'
|
|
8
8
|
import Playground from './Playground'
|
|
9
9
|
import Versions from './Versions'
|
|
10
10
|
import React, { useState } from 'react'
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import BorderedBox from './BorderedBox'
|
|
4
|
+
import HorizontalSeparator from './HorizontalSeparator'
|
|
5
|
+
import PullRequestIcon from './icons/PullRequestIcon'
|
|
6
|
+
import styles from './PullRequest.module.css'
|
|
7
|
+
import VerticalSeparator from './VerticalSeparator'
|
|
8
|
+
export default function PullRequest ({ id, title, lastCommit, url }) {
|
|
9
|
+
return (
|
|
10
|
+
<BorderedBox color='green'>
|
|
11
|
+
<div className={styles.header}>
|
|
12
|
+
<PullRequestIcon />
|
|
13
|
+
<span className={styles.id}>#{id}</span>
|
|
14
|
+
<span><a href={url} target='_blank' rel='noreferrer'>{url}</a></span>
|
|
15
|
+
</div>
|
|
16
|
+
<div className={styles.content}>
|
|
17
|
+
<div>
|
|
18
|
+
<span className={styles.label}>PR Title: </span>
|
|
19
|
+
<span className={styles.value}>{title}</span>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<HorizontalSeparator />
|
|
24
|
+
<div>
|
|
25
|
+
<span className={styles.label}>Last commit by: </span>
|
|
26
|
+
<span className={styles.value}>{lastCommit.author}</span>
|
|
27
|
+
<VerticalSeparator />
|
|
28
|
+
<span className={styles.label}>Commit SHA: </span>
|
|
29
|
+
<span className={styles.value}>{lastCommit.sha}</span>
|
|
30
|
+
<VerticalSeparator />
|
|
31
|
+
<span className={styles.label}>Last Update: </span>
|
|
32
|
+
<span className={styles.value}>{lastCommit.date}</span>
|
|
33
|
+
</div>
|
|
34
|
+
</BorderedBox>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
@apply flex flex-col;
|
|
3
|
+
}
|
|
4
|
+
.id {
|
|
5
|
+
@apply text-xl text-main-green font-semibold;
|
|
6
|
+
}
|
|
7
|
+
.header {
|
|
8
|
+
@apply flex items-center gap-x-4 mb-4;
|
|
9
|
+
}
|
|
10
|
+
.label {
|
|
11
|
+
@apply font-thin;
|
|
12
|
+
}
|
|
13
|
+
.value {
|
|
14
|
+
@apply font-semibold;
|
|
15
|
+
}
|
|
16
|
+
.content {
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -6,15 +6,23 @@ import styles from './SearchBar.module.css'
|
|
|
6
6
|
import commonStyles from './Common.module.css'
|
|
7
7
|
export default function SearchBar (props) {
|
|
8
8
|
const inputRef = useRef()
|
|
9
|
-
const {
|
|
10
|
-
|
|
9
|
+
const { onSubmit, onChange } = props
|
|
11
10
|
function handleSearch () {
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
if (onSubmit) {
|
|
12
|
+
const value = inputRef.current.value
|
|
13
|
+
return onSubmit(value)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function handleChange () {
|
|
18
|
+
if (onChange) {
|
|
19
|
+
const value = inputRef.current.value
|
|
20
|
+
return onChange(value)
|
|
21
|
+
}
|
|
14
22
|
}
|
|
15
23
|
return (
|
|
16
24
|
<div className={`${styles.input} ${commonStyles.padded}`}>
|
|
17
|
-
<input type='text' placeholder='Search' className='grow' ref={inputRef} />
|
|
25
|
+
<input type='text' placeholder='Search' className='grow' ref={inputRef} onChange={handleChange} />
|
|
18
26
|
<button onClick={handleSearch}>
|
|
19
27
|
<FontAwesomeIcon color='white' icon={faSearch} />
|
|
20
28
|
</button>
|
|
@@ -22,7 +22,7 @@ export default function TabbedWindow (props) {
|
|
|
22
22
|
<div className={styles['tabs-header']}>
|
|
23
23
|
{headers.map((header, index) => {
|
|
24
24
|
return (
|
|
25
|
-
<span onClick={() => setSelected(index)} key={index} className={selected === index ? styles['selected-tab'] : ''}>
|
|
25
|
+
<span onClick={() => setSelected(index)} key={index} className={`${styles.tab} ${selected === index ? styles['selected-tab'] : ''}`}>
|
|
26
26
|
{header}
|
|
27
27
|
</span>
|
|
28
28
|
)
|
|
@@ -3,8 +3,15 @@
|
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
.tabs-header {
|
|
6
|
-
@apply flex justify-
|
|
6
|
+
@apply flex justify-start text-white uppercase hover:cursor-pointer mb-4 tracking-[.25rem] h-[2rem];
|
|
7
|
+
}
|
|
8
|
+
.tab {
|
|
9
|
+
@apply mr-4 min-w-[105px] text-center;
|
|
7
10
|
}
|
|
8
11
|
.selected-tab {
|
|
9
12
|
@apply underline text-main-green underline-offset-8 font-bold;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.tabs-content {
|
|
16
|
+
@apply h-screen
|
|
10
17
|
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
const PullRequestIcon = () => (
|
|
4
|
+
<svg
|
|
5
|
+
width={40}
|
|
6
|
+
height={40}
|
|
7
|
+
fill='none'
|
|
8
|
+
xmlns='http://www.w3.org/2000/svg'
|
|
9
|
+
>
|
|
10
|
+
<circle cx={9.5} cy={30.5} r={4.5} stroke='#fff' strokeWidth={2} />
|
|
11
|
+
<circle cx={9.5} cy={9.5} r={4.5} stroke='#fff' strokeWidth={2} />
|
|
12
|
+
<path stroke='#fff' strokeWidth={2} d='M9 14v12' />
|
|
13
|
+
<circle cx={30.5} cy={30.5} r={4.5} stroke='#fff' strokeWidth={2} />
|
|
14
|
+
<path
|
|
15
|
+
d='M30.5 26V10.5a1 1 0 0 0-1-1H23'
|
|
16
|
+
stroke='#fff'
|
|
17
|
+
strokeWidth={2}
|
|
18
|
+
strokeLinecap='round'
|
|
19
|
+
strokeLinejoin='round'
|
|
20
|
+
/>
|
|
21
|
+
<path
|
|
22
|
+
d='m26 5-4.5 4.5L26 14'
|
|
23
|
+
stroke='#fff'
|
|
24
|
+
strokeWidth={2}
|
|
25
|
+
strokeLinecap='round'
|
|
26
|
+
strokeLinejoin='round'
|
|
27
|
+
/>
|
|
28
|
+
</svg>
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
export default PullRequestIcon
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
import PullRequest from '../components/PullRequest'
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Platformatic/PullRequest',
|
|
5
|
+
component: PullRequest,
|
|
6
|
+
argTypes: {
|
|
7
|
+
color: { control: 'color' }
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const Template = (args) => <PullRequest {...args}>Hello Platformatic</PullRequest>
|
|
12
|
+
|
|
13
|
+
export const Standard = Template.bind({})
|
|
14
|
+
Standard.args = {
|
|
15
|
+
id: '88',
|
|
16
|
+
title: 'doc: host => hostname, binded to 0.0.0.0 to be more container friendly',
|
|
17
|
+
url: 'http://example.com',
|
|
18
|
+
lastCommit: {
|
|
19
|
+
sha: 'bgb3ffe3',
|
|
20
|
+
author: 'Foobar',
|
|
21
|
+
date: '2022-10-11'
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
import SearchBar from '../components/SearchBar'
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Platformatic/SearchBar',
|
|
5
|
+
component: SearchBar,
|
|
6
|
+
argTypes: {
|
|
7
|
+
color: { control: 'color' }
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const Template = (args) => {
|
|
11
|
+
return (
|
|
12
|
+
<>
|
|
13
|
+
<SearchBar {...args}>Hello Platformatic</SearchBar>
|
|
14
|
+
</>
|
|
15
|
+
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
export const Standard = Template.bind({})
|
|
19
|
+
Standard.args = {
|
|
20
|
+
onChange: (value) => {
|
|
21
|
+
console.log('Current search: ' + value)
|
|
22
|
+
},
|
|
23
|
+
onSubmit: (value) => {
|
|
24
|
+
alert('Query value: ' + value)
|
|
25
|
+
}
|
|
26
|
+
}
|