@platformatic/ui-components 0.1.2 → 0.1.4

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
@@ -6,12 +6,15 @@ import BorderedBox from './src/components/BorderedBox'
6
6
  import BorderedText from './src/components/BorderedText'
7
7
  import HorizontalSeparator from './src/components/HorizontalSeparator'
8
8
  import Layout from './src/components/layouts/Layout'
9
+ import TwoColumnsLayout from './src/components/layouts/TwoColumnsLayout'
9
10
  import Playground from './src/components/Playground'
10
11
  import Prs from './src/components/Pr'
11
12
  import SearchBar from './src/components/SearchBar'
12
13
  import TabbedWindow from './src/components/TabbedWindow'
13
14
  import Versions from './src/components/Versions'
14
15
  import VerticalSeparator from './src/components/VerticalSeparator'
16
+ import LoginButton from './src/components/LoginButton'
17
+ import GHLoginButton from './src/components/GHLoginButton'
15
18
  export {
16
19
  Api,
17
20
  ApiDetails,
@@ -19,10 +22,13 @@ export {
19
22
  BorderedText,
20
23
  HorizontalSeparator,
21
24
  Layout,
25
+ TwoColumnsLayout,
22
26
  Playground,
23
27
  Prs,
24
28
  SearchBar,
25
29
  TabbedWindow,
26
30
  Versions,
27
- VerticalSeparator
31
+ VerticalSeparator,
32
+ LoginButton,
33
+ GHLoginButton
28
34
  }
package/package.json CHANGED
@@ -1,21 +1,22 @@
1
1
  {
2
2
  "name": "@platformatic/ui-components",
3
3
  "description": "Platformatic UI Components",
4
- "version": "0.1.2",
4
+ "version": "0.1.4",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "scripts": {
8
8
  "dev": "vite",
9
9
  "build": "vite build",
10
10
  "preview": "vite preview",
11
- "storybook": "start-storybook -p 6006",
12
- "build-storybook": "build-storybook",
11
+ "storybook": "NODE_OPTIONS='--openssl-legacy-provider' start-storybook -p 6006",
12
+ "build-storybook": "NODE_OPTIONS='--openssl-legacy-provider' build-storybook",
13
13
  "tailwind:watch": "tailwindcss -i ./src/styles/main.css -o ./dist/main.css --watch",
14
14
  "tailwind": "tailwindcss -i ./src/styles/main.css -o ./dist/main.css",
15
15
  "lint": "standard --fix"
16
16
  },
17
17
  "dependencies": {
18
18
  "@fortawesome/fontawesome-svg-core": "^6.2.0",
19
+ "@fortawesome/free-brands-svg-icons": "^6.2.0",
19
20
  "@fortawesome/free-solid-svg-icons": "^6.2.0",
20
21
  "@fortawesome/react-fontawesome": "^0.2.0",
21
22
  "autoprefixer": "^10.4.12",
@@ -1,5 +1,5 @@
1
1
  'use strict'
2
-
2
+ import React from 'react'
3
3
  import BorderedText from '../BorderedText'
4
4
 
5
5
  export default function Endpoints (props) {
@@ -4,6 +4,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
4
4
  import { faDatabase, faFileLines, faGear } from '@fortawesome/free-solid-svg-icons'
5
5
  import BorderedText from '../BorderedText'
6
6
  import styles from './Footer.module.css'
7
+ import React from 'react'
7
8
  export default function ApiFooter (props) {
8
9
  const { graphql, openapi } = props
9
10
  return (
@@ -1,4 +1,5 @@
1
1
  'use strict'
2
+ import React from 'react'
2
3
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
3
4
  import { faCircle } from '@fortawesome/free-solid-svg-icons'
4
5
  export default function ApiStatus (props) {
@@ -1,5 +1,5 @@
1
1
  'use strict'
2
-
2
+ import React from 'react'
3
3
  import BorderedText from '../BorderedText'
4
4
 
5
5
  export default function ApiVersion (props) {
@@ -9,7 +9,7 @@ import ApiStatus from './Api/Status'
9
9
  import BorderedBox from './BorderedBox'
10
10
  import HorizontalSeparator from './HorizontalSeparator'
11
11
  import styles from './Api.module.css'
12
- import { useState } from 'react'
12
+ import React, { useState } from 'react'
13
13
 
14
14
  function ApiName (props) {
15
15
  const { name } = props
@@ -5,9 +5,9 @@ import BorderedBox from './BorderedBox'
5
5
  import BorderedText from './BorderedText'
6
6
  import HorizontalSeparator from './HorizontalSeparator'
7
7
  import TwoColumnsLayout from './layouts/TwoColumnsLayout'
8
- import StatsView from './StatView'
8
+ import StatsView from './StatsView'
9
9
  import VerticalSeparator from './VerticalSeparator'
10
-
10
+ import React from 'react'
11
11
  export default function ApiDetails (props) {
12
12
  const apiData = props.data
13
13
  const { url, repository, version, openapi, graphql, source, lastDeploy } = apiData
@@ -3,6 +3,7 @@
3
3
  import { getColor } from '../lib/utils'
4
4
  import styles from './BorderedBox.module.css'
5
5
  import commonStyles from './Common.module.css'
6
+ import React from 'react'
6
7
  export default function BorderedBox (props) {
7
8
  const { classes, color, children } = props
8
9
  const borderColor = getColor('border', color)
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
  import styles from './BorderedText.module.css'
3
-
3
+ import React from 'react'
4
4
  export default function BorderedText (props) {
5
5
  return (
6
6
  <span className={styles.bordered}>{props.text}</span>
@@ -0,0 +1,15 @@
1
+ import React from 'react'
2
+ import PropTypes from 'prop-types'
3
+ import LoginButton from './LoginButton'
4
+ import { faGithub } from '@fortawesome/free-brands-svg-icons'
5
+
6
+ export default function GHLoginButton ({ onClick, ...props }) {
7
+ return (
8
+ <LoginButton
9
+ label='Continue with Github'
10
+ onClick={onClick}
11
+ icon={faGithub}
12
+ {...props}
13
+ />
14
+ )
15
+ }
@@ -1,5 +1,5 @@
1
1
  'use strict'
2
-
2
+ import React from 'react'
3
3
  export default function HorizontalSeparator () {
4
4
  return <hr className='text-dark-green my-4' />
5
5
  }
@@ -0,0 +1,17 @@
1
+ import React from 'react'
2
+ import PropTypes from 'prop-types'
3
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
4
+ import styles from './LoginButton.module.css'
5
+
6
+ export default function LoginButton ({ icon, label, onClick, ...props }) {
7
+ return (
8
+ <button
9
+ type='button'
10
+ onClick={onClick}
11
+ className={styles.button}
12
+ {...props}
13
+ >
14
+ {icon ? <FontAwesomeIcon icon={icon} /> : null} &nbsp;{label}
15
+ </button>
16
+ )
17
+ }
@@ -0,0 +1,3 @@
1
+ .button {
2
+ @apply bg-light-green text-main-dark-blue font-bold py-2 px-4 rounded;
3
+ }
@@ -7,7 +7,7 @@ import TabbedWindow from './TabbedWindow'
7
7
  import Prs from './Pr'
8
8
  import Playground from './Playground'
9
9
  import Versions from './Versions'
10
- import { useState } from 'react'
10
+ import React, { useState } from 'react'
11
11
  export default function Main () {
12
12
  const [currentSearch, setCurrentSearch] = useState('')
13
13
  const apis = [
@@ -1,5 +1,5 @@
1
1
  'use strict'
2
-
2
+ import React from 'react'
3
3
  import BorderedBox from './BorderedBox'
4
4
 
5
5
  export default function Playground () {
@@ -1,5 +1,5 @@
1
1
  'use strict'
2
-
2
+ import React from 'react'
3
3
  import BorderedBox from './BorderedBox'
4
4
 
5
5
  export default function Prs () {
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
+ import React, { useRef } from 'react'
2
3
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
3
4
  import { faSearch } from '@fortawesome/free-solid-svg-icons'
4
- import { useRef } from 'react'
5
5
  import styles from './SearchBar.module.css'
6
6
  import commonStyles from './Common.module.css'
7
7
  export default function SearchBar (props) {
@@ -1,5 +1,5 @@
1
1
  'use strict'
2
- import { Fragment } from 'react'
2
+ import React from 'react'
3
3
  import { getColor } from '../lib/utils'
4
4
  export default function StatValue (props) {
5
5
  const { value, color, label, pre } = props
@@ -6,7 +6,7 @@ import styles from './StatsView.module.css'
6
6
  import HorizontalSeparator from './HorizontalSeparator'
7
7
  import VerticalSeparator from './VerticalSeparator'
8
8
  import StatValue from './StatValue'
9
-
9
+ import React from 'react'
10
10
  export default function StatsView (props) {
11
11
  const { title, stats } = props
12
12
  const mainStat = stats.mainStat
@@ -1,5 +1,5 @@
1
1
  'use strict'
2
-
2
+ import React from 'react'
3
3
  import BorderedBox from './BorderedBox'
4
4
 
5
5
  export default function Versions () {
@@ -1,5 +1,5 @@
1
1
  'use strict'
2
-
2
+ import React from 'react'
3
3
  export default function VerticalSeparator () {
4
4
  return <span className='text-dark-green m-3'> | </span>
5
5
  }
@@ -1,4 +1,5 @@
1
1
  'use strict'
2
+ import React from 'react'
2
3
 
3
4
  export default function Layout (props) {
4
5
  return (
@@ -1,5 +1,5 @@
1
1
  'use strict'
2
-
2
+ import React from 'react'
3
3
  export default function TwoColumnsLayout (props) {
4
4
  return (
5
5
  <div className='grid grid-cols-2 gap-x-4'>
@@ -17,3 +17,8 @@ export const Green = Template.bind({})
17
17
  Green.args = {
18
18
  color: 'green'
19
19
  }
20
+ export const Red = Template.bind({})
21
+
22
+ Red.args = {
23
+ color: 'red'
24
+ }
@@ -0,0 +1,14 @@
1
+ import React from 'react'
2
+ import GHLoginButton from '../components/GHLoginButton'
3
+
4
+ export default {
5
+ title: 'Example/GHLoginButton',
6
+ component: GHLoginButton
7
+ }
8
+
9
+ const Template = (args) => <GHLoginButton {...args} />
10
+
11
+ export const Default = Template.bind({})
12
+ Default.args = {
13
+ onClick: () => alert('clicked')
14
+ }
@@ -0,0 +1,15 @@
1
+ import React from 'react'
2
+ import LoginButton from '../components/LoginButton'
3
+
4
+ export default {
5
+ title: 'Example/LoginButton',
6
+ component: LoginButton
7
+ }
8
+
9
+ const Template = (args) => <LoginButton {...args} />
10
+
11
+ export const NoIcon = Template.bind({})
12
+ NoIcon.args = {
13
+ label: 'Click here',
14
+ onClick: () => alert('clicked')
15
+ }
@@ -9,6 +9,7 @@ module.exports = {
9
9
  colors: {
10
10
  'main-green': '#21FA90',
11
11
  'dark-green': '#02783F',
12
+ 'light-green': '#21F190',
12
13
  'main-dark-blue': '#00283D',
13
14
  'dark-blue': '#00344F',
14
15
  white: '#FFFFFF',
package/vite.config.js CHANGED
@@ -2,14 +2,5 @@ import { defineConfig } from 'vite'
2
2
  import react from '@vitejs/plugin-react'
3
3
  /** @type {import('vite').UserConfig} */
4
4
  export default defineConfig({
5
- plugins: [react()],
6
- build: {
7
- rollupOptions: {
8
- output: {
9
- assetFileNames: 'platformatic-ui.css',
10
- chunkFileNames: 'platformatic-ui.js',
11
- manualChunks: undefined
12
- }
13
- }
14
- }
5
+ plugins: [react()]
15
6
  })