-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[pat] Token UI polish #15015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pat] Token UI polish #15015
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* Copyright (c) 2022 Gitpod GmbH. All rights reserved. | ||
* Licensed under the GNU Affero General Public License (AGPL). | ||
* See License-AGPL.txt in the project root for license information. | ||
*/ | ||
|
||
import { ReactComponent as Spinner } from "../icons/Spinner.svg"; | ||
|
||
export function SpinnerLoader(props: { content?: string }) { | ||
return ( | ||
<div className="flex items-center justify-center space-x-2 text-gray-400 text-sm pt-16 pb-40"> | ||
<Spinner className="h-4 w-4 animate-spin" /> | ||
{props.content && <span>{props.content}</span>} | ||
</div> | ||
); | ||
} | ||
|
||
interface SpinnerContentProps { | ||
loading?: boolean; | ||
content?: string; | ||
children: React.ReactChild[] | React.ReactChild | React.ReactNode; | ||
} | ||
export function SpinnerOverlayLoader(props: SpinnerContentProps) { | ||
return ( | ||
<div className="relative"> | ||
{props.loading && ( | ||
<div className="absolute h-full w-full"> | ||
<div className="flex items-center justify-center space-x-2 text-gray-400 text-sm h-full"> | ||
<Spinner className="h-4 w-4 animate-spin" /> | ||
{props.content && <span>{props.content}</span>} | ||
</div> | ||
</div> | ||
)} | ||
<div className={props.loading ? "opacity-40 select-none pointer-events-none" : ""}>{props.children}</div> | ||
</div> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,21 +4,27 @@ | |
* See License-AGPL.txt in the project root for license information. | ||
*/ | ||
|
||
export type PillType = "info" | "warn" | "success"; | ||
|
||
const PillClsMap: Record<PillType, string> = { | ||
info: "bg-blue-50 text-blue-500 dark:bg-blue-500 dark:text-blue-100", | ||
warn: "bg-orange-100 text-orange-700 dark:bg-orange-600 dark:text-orange-100", | ||
success: "bg-green-100 text-green-700 dark:bg-green-600 dark:text-green-100", | ||
}; | ||
Comment on lines
+9
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. praise: Thank you for extending this component, @jeanp413 & @mustard-mh! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually this is @mustard-mh change 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I realized this a few hours after posting the comment above. Thanks for giving credit where credit is due, @jeanp413! 🧡 |
||
|
||
/** | ||
* Renders a pill. | ||
* | ||
* **type**\ | ||
* info: Renders a blue pile label (default).\ | ||
* warn: Renders an orange pile label. | ||
* success: Renders an green pile label. | ||
* | ||
* **className**\ | ||
* Add additional css classes to style this component. | ||
*/ | ||
export default function PillLabel(props: { children?: React.ReactNode; type?: "info" | "warn"; className?: string }) { | ||
const infoStyle = "bg-blue-50 text-blue-500 dark:bg-blue-500 dark:text-blue-100"; | ||
const warnStyle = "bg-orange-100 text-orange-700 dark:bg-orange-600 dark:text-orange-100"; | ||
const style = `px-2 py-1 text-sm uppercase rounded-xl ${props.type === "warn" ? warnStyle : infoStyle} ${ | ||
props.className | ||
}`; | ||
export default function PillLabel(props: { children?: React.ReactNode; type?: PillType; className?: string }) { | ||
const type = props.type || "info"; | ||
const style = `px-2 py-1 text-sm uppercase rounded-xl ${PillClsMap[type]} ${props.className}`; | ||
return <span className={style}>{props.children}</span>; | ||
} |
Uh oh!
There was an error while loading. Please reload this page.