Skip to content

Commit aa7d384

Browse files
committed
feat: Start adding more buttons
1 parent 725c1e7 commit aa7d384

File tree

7 files changed

+287
-239
lines changed

7 files changed

+287
-239
lines changed

src/components/RestartButton.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
import { Button } from '@/components/ui/button';
2+
import { buttonVariants } from '@/components/ui/buttonVariants';
23
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
34
import { InstanceClientConfig } from '@/config/instanceClientConfig';
45
import { useRestartClusterClick } from '@/hooks/useRestartClusterClick';
56
import { useRestartInstanceClick } from '@/hooks/useRestartInstanceClick';
7+
import { cx, VariantProps } from 'class-variance-authority';
68
import { RotateCcwIcon } from 'lucide-react';
79

8-
interface RestartButtonParams extends InstanceClientConfig {
10+
interface RestartButtonParams extends InstanceClientConfig, VariantProps<typeof buttonVariants> {
911
targetNoun: 'Instance' | 'Cluster';
1012
operation: 'restart_service' | 'restart';
13+
className?: string;
1114
}
1215

1316
export function RestartButton({
1417
targetNoun,
1518
instanceClient,
1619
operation,
20+
variant,
21+
className,
1722
}: RestartButtonParams) {
1823
const {
1924
onRestartClick: onRestartClusterClick,
@@ -23,12 +28,12 @@ export function RestartButton({
2328
return (<Tooltip>
2429
<TooltipTrigger asChild>
2530
<Button
26-
variant="positiveOutline"
27-
className="mx-0 md:mx-4 rounded-full"
31+
variant={variant || 'positiveOutline'}
32+
className={cx('mx-0 md:mx-4 rounded-full', className)}
2833
onClick={targetNoun === 'Cluster' && operation === 'restart' ? onRestartClusterClick : onRestartClick}
2934
disabled={isRestartPending || isRestartClusterPending}
3035
>
31-
<RotateCcwIcon /> Restart {targetNoun}
36+
<RotateCcwIcon /> Restart {targetNoun}
3237
</Button>
3338
</TooltipTrigger>
3439
<TooltipContent>

src/components/ui/buttonVariants.tsx

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,37 @@ import { cva } from 'class-variance-authority';
33
const hoverBounce = 'hover:-translate-y-1 transition duration-200';
44
const outlineCommon = 'border bg-transparent border-2 text-white shadow-xs hover:bg-grey-700/40';
55
export const buttonVariants = cva(
6-
`inline-flex
7-
items-center
8-
justify-center
9-
gap-2
10-
whitespace-nowrap
11-
rounded-lg
12-
text-sm
13-
transition-[color,box-shadow]
14-
disabled:pointer-events-none
15-
disabled:opacity-50
16-
[&_svg]:pointer-events-none
17-
[&_svg:not([class*='size-'])]:size-4
18-
[&_svg]:shrink-0
19-
ring-ring/10
20-
dark:ring-ring/20
21-
dark:outline-ring/40
22-
outline-ring/50
23-
focus-visible:ring-1
24-
focus-visible:outline-1
25-
focus-visible:ring-purple-200
6+
`inline-flex
7+
items-center
8+
justify-center
9+
gap-2
10+
whitespace-nowrap
11+
rounded-lg
12+
text-sm
13+
transition-[color,box-shadow]
14+
disabled:pointer-events-none
15+
disabled:opacity-50
16+
[&_svg]:pointer-events-none
17+
[&_svg:not([class*='size-'])]:size-4
18+
[&_svg]:shrink-0
19+
ring-ring/10
20+
dark:ring-ring/20
21+
dark:outline-ring/40
22+
outline-ring/50
23+
focus-visible:ring-1
24+
focus-visible:outline-1
25+
focus-visible:ring-purple-200
2626
aria-invalid:focus-visible:ring-0`,
2727
{
2828
variants: {
2929
variant: {
3030
default: 'bg-primary text-primary-foreground shadow-sm hover:bg-primary/90',
3131
submit:
3232
'bg-gradient-to-r from-blue-100 from-0% to-blue to-100% hover:bg-gradient-to-r hover:from-blue text-primary-foreground shadow-sm',
33-
destructive: 'bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90',
33+
destructive: 'bg-destructive shadow-xs hover:bg-destructive/90',
3434
secondary: 'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80',
3535
ghost: 'hover:bg-accent hover:text-muted-foreground',
36+
destructiveGhost: 'hover:bg-accent hover:text-red',
3637
link: 'text-primary underline-offset-4 hover:underline',
3738
positive: 'bg-green text-white shadow-xs hover:bg-green/90',
3839
warning: 'bg-yellow text-white shadow-xs hover:bg-yellow/90',

src/features/instance/applications/components/ApplicationsSidebar/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export function ApplicationsSidebar() {
3838
}
3939
}, [openedEntry, focusedItem, items]);
4040

41-
// TODO: FAB in bottom right for actions
4241
// TODO: add file
4342
// TODO: add folder
4443
// TODO: delete file

src/features/instance/applications/components/TextEditorView/directory-read-me.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.directoryReadMe {
2-
padding: 6px 24px;
2+
padding: 40px 24px 6px;
33

44
h1 {
55
font-size: 3rem;

0 commit comments

Comments
 (0)