mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-25 10:18:31 +02:00
Rename BadgeButton to PillButton
This commit is contained in:
@@ -13,7 +13,7 @@ import {
|
|||||||
setupOrConfigureEncryption,
|
setupOrConfigureEncryption,
|
||||||
withEncryptionEnabled,
|
withEncryptionEnabled,
|
||||||
} from '../lib/setupOrConfigureEncryption';
|
} from '../lib/setupOrConfigureEncryption';
|
||||||
import { BadgeButton } from './core/BadgeButton';
|
import { PillButton } from './core/PillButton';
|
||||||
import { DismissibleBanner } from './core/DismissibleBanner';
|
import { DismissibleBanner } from './core/DismissibleBanner';
|
||||||
import type { GenericCompletionConfig } from './core/Editor/genericCompletion';
|
import type { GenericCompletionConfig } from './core/Editor/genericCompletion';
|
||||||
import { Heading } from './core/Heading';
|
import { Heading } from './core/Heading';
|
||||||
@@ -113,20 +113,20 @@ export function EnvironmentEditor({ environment, hideName, className, setRef }:
|
|||||||
{!hideName && <div className="mr-2">{environment?.name}</div>}
|
{!hideName && <div className="mr-2">{environment?.name}</div>}
|
||||||
{isEncryptionEnabled ? (
|
{isEncryptionEnabled ? (
|
||||||
!allVariableAreEncrypted ? (
|
!allVariableAreEncrypted ? (
|
||||||
<BadgeButton color="notice" onClick={() => encryptEnvironment(environment)}>
|
<PillButton color="notice" onClick={() => encryptEnvironment(environment)}>
|
||||||
Encrypt All Variables
|
Encrypt All Variables
|
||||||
</BadgeButton>
|
</PillButton>
|
||||||
) : (
|
) : (
|
||||||
<BadgeButton color="secondary" onClick={setupOrConfigureEncryption}>
|
<PillButton color="secondary" onClick={setupOrConfigureEncryption}>
|
||||||
Encryption Settings
|
Encryption Settings
|
||||||
</BadgeButton>
|
</PillButton>
|
||||||
)
|
)
|
||||||
) : (
|
) : (
|
||||||
<BadgeButton color="secondary" onClick={() => valueVisibility.set((v) => !v)}>
|
<PillButton color="secondary" onClick={() => valueVisibility.set((v) => !v)}>
|
||||||
{valueVisibility.value ? 'Hide Values' : 'Show Values'}
|
{valueVisibility.value ? 'Hide Values' : 'Show Values'}
|
||||||
</BadgeButton>
|
</PillButton>
|
||||||
)}
|
)}
|
||||||
<BadgeButton
|
<PillButton
|
||||||
color="secondary"
|
color="secondary"
|
||||||
rightSlot={<EnvironmentSharableTooltip />}
|
rightSlot={<EnvironmentSharableTooltip />}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
@@ -134,7 +134,7 @@ export function EnvironmentEditor({ environment, hideName, className, setRef }:
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{environment.public ? 'Sharable' : 'Private'}
|
{environment.public ? 'Sharable' : 'Private'}
|
||||||
</BadgeButton>
|
</PillButton>
|
||||||
</Heading>
|
</Heading>
|
||||||
{environment.public && (!isEncryptionEnabled || !allVariableAreEncrypted) && (
|
{environment.public && (!isEncryptionEnabled || !allVariableAreEncrypted) && (
|
||||||
<DismissibleBanner
|
<DismissibleBanner
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { useAtomValue } from 'jotai';
|
|||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import { openSettings } from '../commands/openSettings';
|
import { openSettings } from '../commands/openSettings';
|
||||||
import { CargoFeature } from './CargoFeature';
|
import { CargoFeature } from './CargoFeature';
|
||||||
import { BadgeButton } from './core/BadgeButton';
|
import { PillButton } from './core/PillButton';
|
||||||
import type { ButtonProps } from './core/Button';
|
import type { ButtonProps } from './core/Button';
|
||||||
|
|
||||||
const details: Record<
|
const details: Record<
|
||||||
@@ -52,11 +52,11 @@ function LicenseBadgeCmp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BadgeButton
|
<PillButton
|
||||||
color={detail.color}
|
color={detail.color}
|
||||||
onClick={() => openSettings.mutate('license')}
|
onClick={() => openSettings.mutate('license')}
|
||||||
>
|
>
|
||||||
{detail.label}
|
{detail.label}
|
||||||
</BadgeButton>
|
</PillButton>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { useToggleCommandPalette } from '../hooks/useToggleCommandPalette';
|
|||||||
import { workspaceLayoutAtom } from '../lib/atoms';
|
import { workspaceLayoutAtom } from '../lib/atoms';
|
||||||
import { setupOrConfigureEncryption } from '../lib/setupOrConfigureEncryption';
|
import { setupOrConfigureEncryption } from '../lib/setupOrConfigureEncryption';
|
||||||
import { CookieDropdown } from './CookieDropdown';
|
import { CookieDropdown } from './CookieDropdown';
|
||||||
import { BadgeButton } from './core/BadgeButton';
|
import { PillButton } from './core/PillButton';
|
||||||
import { Icon } from './core/Icon';
|
import { Icon } from './core/Icon';
|
||||||
import { IconButton } from './core/IconButton';
|
import { IconButton } from './core/IconButton';
|
||||||
import { HStack } from './core/Stacks';
|
import { HStack } from './core/Stacks';
|
||||||
@@ -52,9 +52,9 @@ export const WorkspaceHeader = memo(function WorkspaceHeader({ className }: Prop
|
|||||||
<div className="flex-1 flex gap-1 items-center h-full justify-end pointer-events-none pr-1">
|
<div className="flex-1 flex gap-1 items-center h-full justify-end pointer-events-none pr-1">
|
||||||
<ImportCurlButton />
|
<ImportCurlButton />
|
||||||
{showEncryptionSetup ? (
|
{showEncryptionSetup ? (
|
||||||
<BadgeButton color="danger" onClick={setupOrConfigureEncryption}>
|
<PillButton color="danger" onClick={setupOrConfigureEncryption}>
|
||||||
Enter Encryption Key
|
Enter Encryption Key
|
||||||
</BadgeButton>
|
</PillButton>
|
||||||
) : (
|
) : (
|
||||||
<LicenseBadge />
|
<LicenseBadge />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import classNames from 'classnames';
|
|||||||
import type { ButtonProps } from './Button';
|
import type { ButtonProps } from './Button';
|
||||||
import { Button } from './Button';
|
import { Button } from './Button';
|
||||||
|
|
||||||
export function BadgeButton({ className, ...props }: ButtonProps) {
|
export function PillButton({ className, ...props }: ButtonProps) {
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
size="2xs"
|
size="2xs"
|
||||||
@@ -9,6 +9,7 @@ export interface TooltipProps {
|
|||||||
content: ReactNode;
|
content: ReactNode;
|
||||||
tabIndex?: number;
|
tabIndex?: number;
|
||||||
size?: 'md' | 'lg';
|
size?: 'md' | 'lg';
|
||||||
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hiddenStyles: CSSProperties = {
|
const hiddenStyles: CSSProperties = {
|
||||||
@@ -19,7 +20,7 @@ const hiddenStyles: CSSProperties = {
|
|||||||
opacity: 0,
|
opacity: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function Tooltip({ children, content, tabIndex, size = 'md' }: TooltipProps) {
|
export function Tooltip({ children, className, content, tabIndex, size = 'md' }: TooltipProps) {
|
||||||
const [isOpen, setIsOpen] = useState<CSSProperties>();
|
const [isOpen, setIsOpen] = useState<CSSProperties>();
|
||||||
const triggerRef = useRef<HTMLButtonElement>(null);
|
const triggerRef = useRef<HTMLButtonElement>(null);
|
||||||
const tooltipRef = useRef<HTMLDivElement>(null);
|
const tooltipRef = useRef<HTMLDivElement>(null);
|
||||||
@@ -95,7 +96,7 @@ export function Tooltip({ children, content, tabIndex, size = 'md' }: TooltipPro
|
|||||||
role="button"
|
role="button"
|
||||||
aria-describedby={isOpen ? id.current : undefined}
|
aria-describedby={isOpen ? id.current : undefined}
|
||||||
tabIndex={tabIndex ?? -1}
|
tabIndex={tabIndex ?? -1}
|
||||||
className="flex-grow-0 inline-flex items-center"
|
className={classNames(className, 'flex-grow-0 flex items-center')}
|
||||||
onClick={handleToggleImmediate}
|
onClick={handleToggleImmediate}
|
||||||
onMouseEnter={handleOpen}
|
onMouseEnter={handleOpen}
|
||||||
onMouseLeave={handleClose}
|
onMouseLeave={handleClose}
|
||||||
|
|||||||
Reference in New Issue
Block a user