Skip to content

Commit 41b5dfa

Browse files
jankeromnesroboquat
authored andcommitted
[dashboard] Minor refactor of Card and SolidCard components
1 parent 773deca commit 41b5dfa

File tree

3 files changed

+44
-38
lines changed

3 files changed

+44
-38
lines changed

components/dashboard/src/admin/License.tsx

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -50,40 +50,44 @@ export default function License() {
5050
>
5151
<div className="flex flex-row space-x-4">
5252
<Card>
53-
{licenseLevel}
54-
{paid}
55-
<div className="mt-4 font-semibold text-sm">Available features:</div>
56-
<div className="flex flex-col items-start text-sm">
57-
{features &&
58-
features.map((feat: string) => (
59-
<span className="inline-flex space-x-1">
60-
{featureList?.includes(feat) ? (
61-
<CheckSvg fill="currentColor" className="self-center mt-1" />
62-
) : (
63-
<XSvg fill="currentColor" className="self-center h-2 mt-1" />
64-
)}
65-
<span>{capitalizeInitials(feat)}</span>
66-
</span>
67-
))}
68-
</div>
53+
<span>
54+
{licenseLevel}
55+
{paid}
56+
<div className="mt-4 font-semibold text-sm">Available features:</div>
57+
<div className="flex flex-col items-start text-sm">
58+
{features &&
59+
features.map((feat: string) => (
60+
<span className="inline-flex space-x-1">
61+
{featureList?.includes(feat) ? (
62+
<CheckSvg fill="currentColor" className="self-center mt-1" />
63+
) : (
64+
<XSvg fill="currentColor" className="self-center h-2 mt-1" />
65+
)}
66+
<span>{capitalizeInitials(feat)}</span>
67+
</span>
68+
))}
69+
</div>
70+
</span>
6971
</Card>
7072
<SolidCard>
71-
<div className="my-2">{statusMessage}</div>
72-
<p className="dark:text-gray-500 font-semibold">Registered Users</p>
73-
<span className="dark:text-gray-300 text-lg">{license?.userCount || 0}</span>
74-
<span className="dark:text-gray-500 text-gray-400 pt-1 text-lg"> / {userLimit} </span>
75-
<p className="dark:text-gray-500 pt-2 font-semibold">License Type</p>
76-
<h4 className="dark:text-gray-300 text-lg">{capitalizeInitials(license?.type || "")}</h4>
77-
<a
78-
className="gp-link flex flex-row mr-2 justify-end font-semibold space-x-2 mt-6"
79-
href="https://www.gitpod.io/self-hosted"
80-
target="_blank"
81-
>
82-
<span className="text-sm">Compare Plans</span>
83-
<div className="self-end">
84-
<LinkSvg />
85-
</div>
86-
</a>
73+
<span>
74+
<div className="my-2">{statusMessage}</div>
75+
<p className="dark:text-gray-500 font-semibold">Registered Users</p>
76+
<span className="dark:text-gray-300 text-lg">{license?.userCount || 0}</span>
77+
<span className="dark:text-gray-500 text-gray-400 pt-1 text-lg"> / {userLimit} </span>
78+
<p className="dark:text-gray-500 pt-2 font-semibold">License Type</p>
79+
<h4 className="dark:text-gray-300 text-lg">{capitalizeInitials(license?.type || "")}</h4>
80+
<a
81+
className="gp-link flex flex-row mr-2 justify-end font-semibold space-x-2 mt-6"
82+
href="https://www.gitpod.io/self-hosted"
83+
target="_blank"
84+
>
85+
<span className="text-sm">Compare Plans</span>
86+
<div className="self-end">
87+
<LinkSvg />
88+
</div>
89+
</a>
90+
</span>
8791
</SolidCard>
8892
</div>
8993
</PageWithSubMenu>

components/dashboard/src/components/Card.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
* See License-AGPL.txt in the project root for license information.
55
*/
66

7-
function Card(p: { className?: string; children?: React.ReactNode }) {
7+
function Card(p: { className?: string; onClick?: () => void; children?: React.ReactNode }) {
88
return (
99
<div
1010
className={
11-
"flex rounded-xl w-72 h-64 px-4 bg-gray-800 dark:bg-gray-100 text-gray-200 dark:text-gray-500" +
11+
"flex flex-col rounded-xl w-72 h-64 px-4 bg-gray-800 dark:bg-gray-100 text-gray-200 dark:text-gray-500 " +
1212
(p.className || "")
1313
}
14+
onClick={p.onClick}
1415
>
15-
<span>{p.children}</span>
16+
{p.children}
1617
</div>
1718
);
1819
}

components/dashboard/src/components/SolidCard.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
* See License-AGPL.txt in the project root for license information.
55
*/
66

7-
function SolidCard(p: { className?: string; children?: React.ReactNode }) {
7+
function SolidCard(p: { className?: string; onClick?: () => void; children?: React.ReactNode }) {
88
return (
99
<div
1010
className={
11-
"flex rounded-xl w-72 h-64 px-4 bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-600" +
11+
"flex flex-col rounded-xl w-72 h-64 px-4 bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-600 " +
1212
(p.className || "")
1313
}
14+
onClick={p.onClick}
1415
>
15-
<span>{p.children}</span>
16+
{p.children}
1617
</div>
1718
);
1819
}

0 commit comments

Comments
 (0)