@platformatic/ui-components 0.1.9 → 0.1.10

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/index.js CHANGED
@@ -5,30 +5,32 @@ import ApiDetails from './src/components/ApiDetail'
5
5
  import BorderedBox from './src/components/BorderedBox'
6
6
  import BorderedText from './src/components/BorderedText'
7
7
  import HorizontalSeparator from './src/components/HorizontalSeparator'
8
+ import GHLoginButton from './src/components/GHLoginButton'
8
9
  import Layout from './src/components/layouts/Layout'
10
+ import LoginButton from './src/components/LoginButton'
9
11
  import TwoColumnsLayout from './src/components/layouts/TwoColumnsLayout'
10
12
  import Playground from './src/components/Playground'
11
- import Prs from './src/components/Pr'
13
+ import PullRequest from './src/components/PullRequest'
12
14
  import SearchBar from './src/components/SearchBar'
13
15
  import TabbedWindow from './src/components/TabbedWindow'
16
+ import TextWithLabel from './src/components/TextWithLabel'
14
17
  import Versions from './src/components/Versions'
15
18
  import VerticalSeparator from './src/components/VerticalSeparator'
16
- import LoginButton from './src/components/LoginButton'
17
- import GHLoginButton from './src/components/GHLoginButton'
18
19
  export {
19
20
  ApiSummary,
20
21
  ApiDetails,
21
22
  BorderedBox,
22
23
  BorderedText,
24
+ GHLoginButton,
23
25
  HorizontalSeparator,
24
26
  Layout,
27
+ LoginButton,
25
28
  TwoColumnsLayout,
26
29
  Playground,
27
- Prs,
30
+ PullRequest,
28
31
  SearchBar,
29
32
  TabbedWindow,
33
+ TextWithLabel,
30
34
  Versions,
31
- VerticalSeparator,
32
- LoginButton,
33
- GHLoginButton
35
+ VerticalSeparator
34
36
  }
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.9",
4
+ "version": "0.1.10",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "scripts": {
@@ -6,8 +6,10 @@ import BorderedText from './BorderedText'
6
6
  import HorizontalSeparator from './HorizontalSeparator'
7
7
  import TwoColumnsLayout from './layouts/TwoColumnsLayout'
8
8
  import StatsView from './StatsView'
9
+ import TextWithLabel from './TextWithLabel'
9
10
  import VerticalSeparator from './VerticalSeparator'
10
11
  import React from 'react'
12
+ import styles from './ApiDetail.module.css'
11
13
  export default function ApiDetails (props) {
12
14
  const { url, repository, version, openapi, graphql, source, lastDeploy } = props
13
15
  const requestStats = {
@@ -55,20 +57,22 @@ export default function ApiDetails (props) {
55
57
  return (
56
58
  <>
57
59
  <BorderedBox classes='api-data'>
58
- <div>
59
- Preview/Staging URL: <a href={url}>{url}</a>
60
- </div>
61
- <div>
62
- Repository: <a href={`https://github.com/${repository}`}>{repository}</a>
63
- </div>
64
- <div>
65
- Version: <BorderedText text={`v${version}`} />
60
+ <div className={styles.main}>
61
+ <div>
62
+ Preview/Staging URL: <a href={url}>{url}</a>
63
+ </div>
64
+ <div>
65
+ Repository: <a href={`https://github.com/${repository}`}>{repository}</a>
66
+ </div>
67
+ <div>
68
+ Version: <BorderedText text={`v${version}`} />
69
+ </div>
66
70
  </div>
67
71
  <HorizontalSeparator />
68
72
  <div className='flex gap-2 items-center'>
69
- <span>Generated with: {source}</span>
73
+ <TextWithLabel label='Generated With' text={source} />
70
74
  <VerticalSeparator />
71
- <span>Last deployed: {lastDeploy}</span>
75
+ <TextWithLabel label='Last deployed' text={lastDeploy} />
72
76
  </div>
73
77
  <div className='flex items-center'>
74
78
  <span className='mr-2'>Endpoints: </span><Endpoints graphql={graphql} openapi={openapi} />
@@ -0,0 +1,3 @@
1
+ .main {
2
+ @apply flex flex-col gap-y-4;
3
+ }
@@ -5,8 +5,9 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
5
5
  import { faLink } from '@fortawesome/free-solid-svg-icons'
6
6
  import ApiVersion from './Api/Version'
7
7
  import ApiIcon from './icons/ApiIcon'
8
- import ApiIconClosed from './Api/ApiIconClosed'
9
- import Separator from './VerticalSeparator'
8
+ import ApiIconClosed from './icons/ApiIconClosed'
9
+ import VerticalSeparator from './VerticalSeparator'
10
+ import TextWithLabel from './TextWithLabel'
10
11
  import ApiStatus from './Api/Status'
11
12
  import BorderedBox from './BorderedBox'
12
13
  import HorizontalSeparator from './HorizontalSeparator'
@@ -46,9 +47,9 @@ export default function ApiSummary (props) {
46
47
  </div>
47
48
 
48
49
  <div className='flex gap-2 items-center'>
49
- <span>Generated with: {source}</span>
50
- <Separator />
51
- <span>Last deployed: {lastDeploy}</span>
50
+ <TextWithLabel label='Generated With' text={source} />
51
+ <VerticalSeparator />
52
+ <TextWithLabel label='Last deployed' text={lastDeploy} />
52
53
  </div>
53
54
  </div>
54
55
 
@@ -4,6 +4,7 @@ import BorderedBox from './BorderedBox'
4
4
  import HorizontalSeparator from './HorizontalSeparator'
5
5
  import PullRequestIcon from './icons/PullRequestIcon'
6
6
  import styles from './PullRequest.module.css'
7
+ import TextWithLabel from './TextWithLabel'
7
8
  import VerticalSeparator from './VerticalSeparator'
8
9
  export default function PullRequest ({ id, title, lastCommit, url }) {
9
10
  return (
@@ -14,22 +15,16 @@ export default function PullRequest ({ id, title, lastCommit, url }) {
14
15
  <span><a href={url} target='_blank' rel='noreferrer'>{url}</a></span>
15
16
  </div>
16
17
  <div className={styles.content}>
17
- <div>
18
- <span className={styles.label}>PR Title: </span>
19
- <span className={styles.value}>{title}</span>
20
- </div>
18
+ <TextWithLabel label='PR Title' text={title} />
21
19
  </div>
22
20
 
23
21
  <HorizontalSeparator />
24
- <div>
25
- <span className={styles.label}>Last commit by: </span>
26
- <span className={styles.value}>{lastCommit.author}</span>
22
+ <div className={styles.footer}>
23
+ <TextWithLabel label='Last commit by' text={lastCommit.author} />
27
24
  <VerticalSeparator />
28
- <span className={styles.label}>Commit SHA: </span>
29
- <span className={styles.value}>{lastCommit.sha}</span>
25
+ <TextWithLabel label='Commit SHA' text={lastCommit.sha} />
30
26
  <VerticalSeparator />
31
- <span className={styles.label}>Last Update: </span>
32
- <span className={styles.value}>{lastCommit.date}</span>
27
+ <TextWithLabel label='Last Update' text={lastCommit.date} />
33
28
  </div>
34
29
  </BorderedBox>
35
30
  )
@@ -7,12 +7,6 @@
7
7
  .header {
8
8
  @apply flex items-center gap-x-4 mb-4;
9
9
  }
10
- .label {
11
- @apply font-thin;
12
- }
13
- .value {
14
- @apply font-semibold;
15
- }
16
- .content {
17
-
10
+ .footer {
11
+ @apply flex items-center
18
12
  }
@@ -0,0 +1,11 @@
1
+ import React from 'react'
2
+ import styles from './TextWithLabel.module.css'
3
+ export default function TextWithLabel ({ label, text, children }) {
4
+ return (
5
+ <div className={styles.container}>
6
+ <span className={styles.label}>{label}:</span>
7
+ {text && <span className={styles.text}>{text}</span>}
8
+ {children && <span>{children}</span>}
9
+ </div>
10
+ )
11
+ }
@@ -0,0 +1,9 @@
1
+ .container {
2
+ @apply text-white
3
+ }
4
+ .label {
5
+ @apply font-thin mr-2;
6
+ }
7
+ .text {
8
+ @apply font-semibold;
9
+ }
@@ -4,7 +4,8 @@ export default {
4
4
  title: 'Platformatic/SearchBar',
5
5
  component: SearchBar,
6
6
  argTypes: {
7
- color: { control: 'color' }
7
+ onChange: { control: 'function' },
8
+ onSubmit: { control: 'function' }
8
9
  }
9
10
  }
10
11
  const Template = (args) => {
@@ -0,0 +1,25 @@
1
+ 'use strict'
2
+
3
+ import TextWithLabel from '../components/TextWithLabel'
4
+ export default {
5
+ title: 'Platformatic/TextWithLabel',
6
+ component: TextWithLabel,
7
+ argTypes: {
8
+ label: { control: 'text' },
9
+ text: { control: 'text' }
10
+ }
11
+ }
12
+ const Template = (args) => <TextWithLabel {...args} />
13
+
14
+ export const Standard = Template.bind({})
15
+
16
+ Standard.args = {
17
+ label: 'Created By',
18
+ text: 'Platformatic Team'
19
+ }
20
+
21
+ export const WithLink = (args) => <TextWithLabel {...args}><a href='https://example.com'>Standard Link</a></TextWithLabel>
22
+
23
+ WithLink.args = {
24
+ label: 'External Link'
25
+ }