@platformatic/ui-components 0.1.19 → 0.1.21
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/.nvmrc +1 -0
- package/dist/assets/index.5ac5acb7.js +797 -0
- package/dist/{platformatic-ui.css → assets/index.e8f4b797.css} +1 -1
- package/dist/index.html +2 -2
- package/dist/main.css +23 -77
- package/index.js +2 -8
- package/package.json +2 -1
- package/src/components/ListElement.module.css +2 -2
- package/src/components/Loadable.jsx +34 -0
- package/src/components/Loadable.module.css +13 -0
- package/src/components/Main.jsx +0 -36
- package/src/components/icons/index.js +7 -0
- package/src/stories/Loadable.stories.jsx +75 -0
- package/src/styles/main.css +0 -6
- package/dist/assets/index.fcbe6de7.js +0 -797
- package/src/components/Api/Endpoints.jsx +0 -14
- package/src/components/Api/Footer.jsx +0 -25
- package/src/components/Api/Footer.module.css +0 -3
- package/src/components/Api/Version.jsx +0 -8
- package/src/components/Api.module.css +0 -11
- package/src/components/ApiDetail.jsx +0 -40
- package/src/components/ApiDetail.module.css +0 -3
- package/src/components/ApiSummary.jsx +0 -77
- package/src/components/FrontpageBackground.jsx +0 -11
- package/src/components/FrontpageBackground.module.css +0 -10
- package/src/components/PullRequest.jsx +0 -66
- package/src/components/PullRequest.module.css +0 -27
- package/src/stories/ApiDetail.stories.jsx +0 -43
- package/src/stories/ApiSummary.stories.jsx +0 -43
- package/src/stories/Frontpage.stories.jsx +0 -42
- package/src/stories/FrontpageBackground.stories.jsx +0 -17
- package/src/stories/PullRequest.stories.jsx +0 -49
|
@@ -1 +1 @@
|
|
|
1
|
-
._input_1v03r_1{box-sizing:border-box;display:flex;height:2.5rem;width:100%;justify-content:space-between;border-radius:.375rem;border-width:1px;border-style:solid;--tw-border-opacity: 1;border-color:rgb(33 250 144 / var(--tw-border-opacity));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}._input_1v03r_1>input:focus{outline:2px solid transparent;outline-offset:2px}.
|
|
1
|
+
._input_1v03r_1{box-sizing:border-box;display:flex;height:2.5rem;width:100%;justify-content:space-between;border-radius:.375rem;border-width:1px;border-style:solid;--tw-border-opacity: 1;border-color:rgb(33 250 144 / var(--tw-border-opacity));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}._input_1v03r_1>input:focus{outline:2px solid transparent;outline-offset:2px}._padded_650jz_1{padding:.625rem .5rem}._bordered_650jz_5{box-sizing:border-box;border-radius:.375rem;border-width:1px;border-style:solid}._tabbed-container_1r9tv_1{--tw-bg-opacity: 1;background-color:rgb(0 40 61 / var(--tw-bg-opacity))}._tabs-header_1r9tv_5{margin-bottom:1rem;display:flex;height:2rem;justify-content:flex-start;text-transform:uppercase;letter-spacing:.25rem;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}._tabs-header_1r9tv_5:hover{cursor:pointer}._tab_1r9tv_1{margin-right:1rem;min-width:105px;text-align:center}._selected-tab_1r9tv_11{font-weight:700;--tw-text-opacity: 1;color:rgb(33 250 144 / var(--tw-text-opacity));text-decoration-line:underline;text-underline-offset:8px}._tabs-content_1r9tv_15{height:100vh}._borderedBox_1fd0d_1{margin-bottom:1rem;flex:1 1 0%;row-gap:1rem;border-radius:.375rem;--tw-bg-opacity: 1;background-color:rgb(0 52 79 / var(--tw-bg-opacity));padding:1.25rem;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:currentColor}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Montserrat}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%;margin-right:auto;margin-left:auto}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.relative{position:relative}.m-3{margin:.75rem}.my-4{margin-top:1rem;margin-bottom:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-5{margin-top:1.25rem;margin-bottom:1.25rem}.mr-2{margin-right:.5rem}.flex{display:flex}.grid{display:grid}.h-screen{height:100vh}.grow{flex-grow:1}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.gap-10{gap:2.5rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.border{border-width:1px}.border-error-red{--tw-border-opacity: 1;border-color:rgb(250 33 33 / var(--tw-border-opacity))}.border-main-green{--tw-border-opacity: 1;border-color:rgb(33 250 144 / var(--tw-border-opacity))}.px-4{padding-left:1rem;padding-right:1rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-5xl{font-size:3rem;line-height:1}.text-6xl{font-size:3.75rem;line-height:1}.text-2xl{font-size:1.5rem;line-height:2rem}.font-bold{font-weight:700}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.text-dark-green{--tw-text-opacity: 1;color:rgb(2 120 63 / var(--tw-text-opacity))}.text-main-green{--tw-text-opacity: 1;color:rgb(33 250 144 / var(--tw-text-opacity))}.text-error-red{--tw-text-opacity: 1;color:rgb(250 33 33 / var(--tw-text-opacity))}:root{--tw-bg-opacity: 1;background-color:rgb(0 40 61 / var(--tw-bg-opacity));font-family:Montserrat}a{--tw-text-opacity: 1;color:rgb(37 136 228 / var(--tw-text-opacity))}input{background-color:transparent}
|
package/dist/index.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Platformatic UI Components</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index.
|
|
8
|
-
<link rel="stylesheet" href="/
|
|
7
|
+
<script type="module" crossorigin src="/assets/index.5ac5acb7.js"></script>
|
|
8
|
+
<link rel="stylesheet" href="/assets/index.e8f4b797.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="root"></div>
|
package/dist/main.css
CHANGED
|
@@ -540,6 +540,10 @@ video {
|
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
542
|
|
|
543
|
+
.relative {
|
|
544
|
+
position: relative;
|
|
545
|
+
}
|
|
546
|
+
|
|
543
547
|
.m-3 {
|
|
544
548
|
margin: 0.75rem;
|
|
545
549
|
}
|
|
@@ -559,22 +563,10 @@ video {
|
|
|
559
563
|
margin-bottom: 1.25rem;
|
|
560
564
|
}
|
|
561
565
|
|
|
562
|
-
.mr-5 {
|
|
563
|
-
margin-right: 1.25rem;
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
.ml-4 {
|
|
567
|
-
margin-left: 1rem;
|
|
568
|
-
}
|
|
569
|
-
|
|
570
566
|
.mr-2 {
|
|
571
567
|
margin-right: 0.5rem;
|
|
572
568
|
}
|
|
573
569
|
|
|
574
|
-
.mr-1 {
|
|
575
|
-
margin-right: 0.25rem;
|
|
576
|
-
}
|
|
577
|
-
|
|
578
570
|
.flex {
|
|
579
571
|
display: flex;
|
|
580
572
|
}
|
|
@@ -583,16 +575,8 @@ video {
|
|
|
583
575
|
display: grid;
|
|
584
576
|
}
|
|
585
577
|
|
|
586
|
-
.
|
|
587
|
-
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
.w-full {
|
|
591
|
-
width: 100%;
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
.w-9 {
|
|
595
|
-
width: 2.25rem;
|
|
578
|
+
.h-screen {
|
|
579
|
+
height: 100vh;
|
|
596
580
|
}
|
|
597
581
|
|
|
598
582
|
.grow {
|
|
@@ -607,26 +591,6 @@ video {
|
|
|
607
591
|
flex-direction: column;
|
|
608
592
|
}
|
|
609
593
|
|
|
610
|
-
.items-center {
|
|
611
|
-
align-items: center;
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
.justify-between {
|
|
615
|
-
justify-content: space-between;
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
.justify-around {
|
|
619
|
-
justify-content: space-around;
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
.gap-4 {
|
|
623
|
-
gap: 1rem;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
.gap-2 {
|
|
627
|
-
gap: 0.5rem;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
594
|
.gap-10 {
|
|
631
595
|
gap: 2.5rem;
|
|
632
596
|
}
|
|
@@ -636,10 +600,6 @@ video {
|
|
|
636
600
|
column-gap: 1rem;
|
|
637
601
|
}
|
|
638
602
|
|
|
639
|
-
.rounded-full {
|
|
640
|
-
border-radius: 9999px;
|
|
641
|
-
}
|
|
642
|
-
|
|
643
603
|
.border {
|
|
644
604
|
border-width: 1px;
|
|
645
605
|
}
|
|
@@ -654,10 +614,6 @@ video {
|
|
|
654
614
|
border-color: rgb(33 250 144 / var(--tw-border-opacity));
|
|
655
615
|
}
|
|
656
616
|
|
|
657
|
-
.p-2 {
|
|
658
|
-
padding: 0.5rem;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
617
|
.px-4 {
|
|
662
618
|
padding-left: 1rem;
|
|
663
619
|
padding-right: 1rem;
|
|
@@ -668,31 +624,33 @@ video {
|
|
|
668
624
|
line-height: 2rem;
|
|
669
625
|
}
|
|
670
626
|
|
|
627
|
+
.text-3xl {
|
|
628
|
+
font-size: 1.875rem;
|
|
629
|
+
line-height: 2.25rem;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
.text-4xl {
|
|
633
|
+
font-size: 2.25rem;
|
|
634
|
+
line-height: 2.5rem;
|
|
635
|
+
}
|
|
636
|
+
|
|
671
637
|
.text-5xl {
|
|
672
638
|
font-size: 3rem;
|
|
673
639
|
line-height: 1;
|
|
674
640
|
}
|
|
675
641
|
|
|
676
|
-
.text-
|
|
677
|
-
font-size:
|
|
678
|
-
line-height: 1
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
.font-semibold {
|
|
682
|
-
font-weight: 600;
|
|
642
|
+
.text-6xl {
|
|
643
|
+
font-size: 3.75rem;
|
|
644
|
+
line-height: 1;
|
|
683
645
|
}
|
|
684
646
|
|
|
685
647
|
.font-bold {
|
|
686
648
|
font-weight: 700;
|
|
687
649
|
}
|
|
688
650
|
|
|
689
|
-
.
|
|
690
|
-
font-weight: 300;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
.text-main-green {
|
|
651
|
+
.text-white {
|
|
694
652
|
--tw-text-opacity: 1;
|
|
695
|
-
color: rgb(
|
|
653
|
+
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
696
654
|
}
|
|
697
655
|
|
|
698
656
|
.text-dark-green {
|
|
@@ -700,9 +658,9 @@ video {
|
|
|
700
658
|
color: rgb(2 120 63 / var(--tw-text-opacity));
|
|
701
659
|
}
|
|
702
660
|
|
|
703
|
-
.text-
|
|
661
|
+
.text-main-green {
|
|
704
662
|
--tw-text-opacity: 1;
|
|
705
|
-
color: rgb(
|
|
663
|
+
color: rgb(33 250 144 / var(--tw-text-opacity));
|
|
706
664
|
}
|
|
707
665
|
|
|
708
666
|
.text-error-red {
|
|
@@ -710,14 +668,6 @@ video {
|
|
|
710
668
|
color: rgb(250 33 33 / var(--tw-text-opacity));
|
|
711
669
|
}
|
|
712
670
|
|
|
713
|
-
@font-face {
|
|
714
|
-
font-family: 'Montserrat';
|
|
715
|
-
|
|
716
|
-
src: local('Montserrat'), url(./fonts/Montserrat/Montserrat-VariableFont_wght.ttf) format('truetype');
|
|
717
|
-
|
|
718
|
-
font-weight: 100 900;
|
|
719
|
-
}
|
|
720
|
-
|
|
721
671
|
:root {
|
|
722
672
|
--tw-bg-opacity: 1;
|
|
723
673
|
background-color: rgb(0 40 61 / var(--tw-bg-opacity));
|
|
@@ -731,8 +681,4 @@ a {
|
|
|
731
681
|
|
|
732
682
|
input {
|
|
733
683
|
background-color: transparent;
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
.hover\:cursor-pointer:hover {
|
|
737
|
-
cursor: pointer;
|
|
738
684
|
}
|
package/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import ApiSummary from './src/components/ApiSummary'
|
|
4
|
-
import ApiDetails from './src/components/ApiDetail'
|
|
5
3
|
import BorderedBox from './src/components/BorderedBox'
|
|
6
4
|
import BorderedText from './src/components/BorderedText'
|
|
7
5
|
import Box from './src/components/Box'
|
|
@@ -9,9 +7,9 @@ import Button from './src/components/Button'
|
|
|
9
7
|
import DetailedMetric from './src/components/DetailedMetric'
|
|
10
8
|
import DropDown from './src/components/DropDown'
|
|
11
9
|
import FollowUs from './src/components/FollowUs'
|
|
12
|
-
import FrontpageBackground from './src/components/FrontpageBackground'
|
|
13
10
|
import GHLoginButton from './src/components/GHLoginButton'
|
|
14
11
|
import HorizontalSeparator from './src/components/HorizontalSeparator'
|
|
12
|
+
import Icons from './src/components/icons'
|
|
15
13
|
import Input from './src/components/Input'
|
|
16
14
|
import Layout from './src/components/layouts/Layout'
|
|
17
15
|
import List from './src/components/List'
|
|
@@ -19,7 +17,6 @@ import ListElement from './src/components/ListElement'
|
|
|
19
17
|
import LoginButton from './src/components/LoginButton'
|
|
20
18
|
import Logo from './src/components/Logo'
|
|
21
19
|
import Playground from './src/components/Playground'
|
|
22
|
-
import PullRequest from './src/components/PullRequest'
|
|
23
20
|
import SearchBar from './src/components/SearchBar'
|
|
24
21
|
import SimpleMetric from './src/components/SimpleMetric'
|
|
25
22
|
import Status from './src/components/Status'
|
|
@@ -29,8 +26,6 @@ import TwoColumnsLayout from './src/components/layouts/TwoColumnsLayout'
|
|
|
29
26
|
import Versions from './src/components/Versions'
|
|
30
27
|
import VerticalSeparator from './src/components/VerticalSeparator'
|
|
31
28
|
export {
|
|
32
|
-
ApiSummary,
|
|
33
|
-
ApiDetails,
|
|
34
29
|
BorderedBox,
|
|
35
30
|
BorderedText,
|
|
36
31
|
Box,
|
|
@@ -38,9 +33,9 @@ export {
|
|
|
38
33
|
DetailedMetric,
|
|
39
34
|
DropDown,
|
|
40
35
|
FollowUs,
|
|
41
|
-
FrontpageBackground,
|
|
42
36
|
HorizontalSeparator,
|
|
43
37
|
GHLoginButton,
|
|
38
|
+
Icons,
|
|
44
39
|
Input,
|
|
45
40
|
Layout,
|
|
46
41
|
List,
|
|
@@ -48,7 +43,6 @@ export {
|
|
|
48
43
|
LoginButton,
|
|
49
44
|
Logo,
|
|
50
45
|
Playground,
|
|
51
|
-
PullRequest,
|
|
52
46
|
SearchBar,
|
|
53
47
|
SimpleMetric,
|
|
54
48
|
Status,
|
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.
|
|
4
|
+
"version": "0.1.21",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"scripts": {
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"react": "^18.2.0",
|
|
28
28
|
"react-dom": "^18.2.0",
|
|
29
29
|
"react-tooltip": "^4.4.3",
|
|
30
|
+
"spinners-react": "^1.0.7",
|
|
30
31
|
"storybook-tailwind-foundations": "^1.1.2"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
.title {
|
|
14
|
-
@apply flex text-light-green font-bold w-full
|
|
14
|
+
@apply flex text-light-green font-bold w-full
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.textCol {
|
|
18
|
-
@apply flex flex-col text-white text-justify w-
|
|
18
|
+
@apply flex flex-col text-white text-justify w-full
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.detailSpace {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { useState, cloneElement, Children } from 'react'
|
|
2
|
+
import styles from './Loadable.module.css'
|
|
3
|
+
import { SpinnerCircular } from 'spinners-react'
|
|
4
|
+
|
|
5
|
+
export default function List ({ ...props }) {
|
|
6
|
+
// If null then loading not started, if true then loading, if false then done loading
|
|
7
|
+
const [loading, setLoading] = useState(null)
|
|
8
|
+
const startLoading = (reset = false) => {
|
|
9
|
+
// We can start only once (unless we reset)
|
|
10
|
+
if (loading === null || reset) {
|
|
11
|
+
setLoading(true)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const stopLoading = () => setLoading(false)
|
|
15
|
+
|
|
16
|
+
const children = Children.map(props.children, child => cloneElement(child, { startLoading, stopLoading }))
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div className={styles.container} data-testid='loadable'>
|
|
20
|
+
{
|
|
21
|
+
loading
|
|
22
|
+
? (
|
|
23
|
+
<>
|
|
24
|
+
<div data-testid='loadable-content' className={styles.relative}>
|
|
25
|
+
<SpinnerCircular className={styles.spinner} thickness={180} size={60} />
|
|
26
|
+
<div className={styles.blurred}>{children}</div>
|
|
27
|
+
</div>
|
|
28
|
+
</>
|
|
29
|
+
)
|
|
30
|
+
: <>{children}</>
|
|
31
|
+
}
|
|
32
|
+
</div>
|
|
33
|
+
)
|
|
34
|
+
}
|
package/src/components/Main.jsx
CHANGED
|
@@ -1,48 +1,13 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import SearchBar from './SearchBar'
|
|
4
|
-
import ApiDetails from './ApiDetail'
|
|
5
|
-
import ApiSummary from './ApiSummary'
|
|
6
4
|
import TabbedWindow from './TabbedWindow'
|
|
7
|
-
import Prs from './PullRequest'
|
|
8
5
|
import Playground from './Playground'
|
|
9
6
|
import Versions from './Versions'
|
|
10
7
|
import React, { useState } from 'react'
|
|
11
8
|
export default function Main () {
|
|
12
9
|
const [currentSearch, setCurrentSearch] = useState('')
|
|
13
|
-
const apis = [
|
|
14
|
-
{
|
|
15
|
-
id: 1,
|
|
16
|
-
name: 'api-online',
|
|
17
|
-
version: '1.2.3',
|
|
18
|
-
source: 'Platformatic DB',
|
|
19
|
-
lastDeploy: '2022-10-10',
|
|
20
|
-
graphql: true,
|
|
21
|
-
openapi: true,
|
|
22
|
-
online: true,
|
|
23
|
-
url: 'https://example.com',
|
|
24
|
-
repository: 'platformatic/example'
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
id: 2,
|
|
28
|
-
name: 'api-offline',
|
|
29
|
-
version: '1.2.3',
|
|
30
|
-
source: 'Platformatic DB',
|
|
31
|
-
lastDeploy: '2022-10-10',
|
|
32
|
-
graphql: true,
|
|
33
|
-
openapi: true,
|
|
34
|
-
online: false
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
10
|
const tabs = [
|
|
38
|
-
{
|
|
39
|
-
label: 'Overview',
|
|
40
|
-
component: () => <ApiDetails data={apis[0]} />
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
label: 'PRs',
|
|
44
|
-
component: () => <Prs />
|
|
45
|
-
},
|
|
46
11
|
{
|
|
47
12
|
label: 'Playground',
|
|
48
13
|
component: () => <Playground />
|
|
@@ -63,7 +28,6 @@ export default function Main () {
|
|
|
63
28
|
<TabbedWindow
|
|
64
29
|
tabs={tabs}
|
|
65
30
|
/>
|
|
66
|
-
{apis.map((api) => { return (<ApiSummary key={api.id} data={api} />) })}
|
|
67
31
|
</>
|
|
68
32
|
)
|
|
69
33
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import Loadable from '../components/Loadable'
|
|
3
|
+
import BorderedBox from '../components/BorderedBox'
|
|
4
|
+
|
|
5
|
+
const loremIpsum = `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus est nisl, maximus aliquet urna eu, consequat semper nisi. Nam vel elit feugiat dui congue elementum. Sed turpis urna, egestas at pharetra et, lacinia ac mauris. Pellentesque cursus, ipsum nec malesuada ornare, dui purus ultrices elit, non blandit nisi quam non nisi. Suspendisse sapien leo, ultricies pretium vulputate sed, malesuada sed justo. Suspendisse euismod erat ut lacus feugiat malesuada. In tempor a eros et egestas. Nam pretium dolor sollicitudin, cursus sem vitae, elementum enim. Nam in nisi ipsum.
|
|
6
|
+
`
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Platformatic/Loadable',
|
|
10
|
+
component: Loadable
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const ContentThatLoads = ({ startLoading }) => {
|
|
14
|
+
startLoading()
|
|
15
|
+
return <BorderedBox>{loremIpsum}</BorderedBox>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const Loading = args =>
|
|
19
|
+
<Loadable {...args}>
|
|
20
|
+
<ContentThatLoads />
|
|
21
|
+
</Loadable>
|
|
22
|
+
Loading.args = {}
|
|
23
|
+
|
|
24
|
+
const ContentThatLoadsAndStops = ({ startLoading, stopLoading }) => {
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
startLoading()
|
|
27
|
+
const timer = setTimeout(() => {
|
|
28
|
+
stopLoading()
|
|
29
|
+
}, 2000)
|
|
30
|
+
return () => clearTimeout(timer)
|
|
31
|
+
}, [])
|
|
32
|
+
return <BorderedBox>{loremIpsum}</BorderedBox>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const LoadsAndStops = args => {
|
|
36
|
+
return (
|
|
37
|
+
<Loadable {...args}>
|
|
38
|
+
<ContentThatLoadsAndStops />
|
|
39
|
+
</Loadable>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
LoadsAndStops.args = {}
|
|
43
|
+
|
|
44
|
+
export const LoadsAndStops2 = args => {
|
|
45
|
+
return (
|
|
46
|
+
<Loadable {...args}>
|
|
47
|
+
<ContentThatLoadsAndStops />
|
|
48
|
+
<ContentThatLoadsAndStops />
|
|
49
|
+
</Loadable>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
LoadsAndStops2.args = {}
|
|
53
|
+
|
|
54
|
+
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
|
|
55
|
+
const ContentThatToggle = ({ startLoading, stopLoading }) => {
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
startLoading()
|
|
58
|
+
const toggle = async () => {
|
|
59
|
+
await sleep(1000)
|
|
60
|
+
stopLoading()
|
|
61
|
+
await sleep(1000)
|
|
62
|
+
startLoading(true)
|
|
63
|
+
}
|
|
64
|
+
toggle()
|
|
65
|
+
}, [])
|
|
66
|
+
return <BorderedBox>{loremIpsum}</BorderedBox>
|
|
67
|
+
}
|
|
68
|
+
export const Toggle = args => {
|
|
69
|
+
return (
|
|
70
|
+
<Loadable {...args}>
|
|
71
|
+
<ContentThatToggle />
|
|
72
|
+
</Loadable>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
Toggle.args = {}
|
package/src/styles/main.css
CHANGED
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
@tailwind components;
|
|
3
3
|
@tailwind utilities;
|
|
4
4
|
|
|
5
|
-
@font-face {
|
|
6
|
-
font-family: 'Montserrat';
|
|
7
|
-
src: local('Montserrat'), url(./fonts/Montserrat/Montserrat-VariableFont_wght.ttf) format('truetype');
|
|
8
|
-
font-weight: 100 900;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
5
|
:root {
|
|
12
6
|
@apply bg-main-dark-blue;
|
|
13
7
|
font-family: 'Montserrat';
|