This commit is contained in:
DCCONSTRUCTIONS
2026-04-18 18:39:25 +03:00
commit 3ba092b60c
4944 changed files with 497564 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
export * from "./oauth-options";
@@ -0,0 +1,43 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import * as React from "react";
import { cn } from "../utils";
export interface OAuthButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
text: string;
icon: React.ReactNode;
compact?: boolean;
}
const OAuthButton = React.forwardRef(function OAuthButton(
props: OAuthButtonProps,
ref: React.ForwardedRef<HTMLButtonElement>
) {
const { text, icon, compact = false, className = "", ...rest } = props;
return (
<button
ref={ref}
className={cn(
"bg-onboarding-background-200 hover:bg-onboarding-background-300 flex h-9 w-full items-center justify-center gap-2 rounded-md border border-strong px-4 py-2.5 text-13 font-medium text-primary duration-300",
className
)}
{...rest}
>
<div className="flex flex-shrink-0 items-center justify-center">{icon}</div>
{!compact && (
<span className="flex flex-grow items-center justify-center text-body-sm-regular transition-opacity duration-300">
{text}
</span>
)}
</button>
);
});
OAuthButton.displayName = "plane-ui-oauth-button";
export { OAuthButton };
@@ -0,0 +1,75 @@
/**
* Copyright (c) 2023-present Plane Software, Inc. and contributors
* SPDX-License-Identifier: AGPL-3.0-only
* See the LICENSE file for details.
*/
import * as React from "react";
import { cn } from "../utils";
import { OAuthButton } from "./oauth-button";
export type TOAuthOption = {
id: string;
text: string;
icon: React.ReactNode;
onClick: () => void;
enabled?: boolean;
};
type OAuthOptionsProps = {
options: TOAuthOption[];
compact?: boolean;
showDivider?: boolean;
dividerLabel?: string;
className?: string;
containerClassName?: string;
};
export function OAuthOptions(props: OAuthOptionsProps) {
const {
options,
compact = false,
showDivider = true,
dividerLabel = "or",
className = "",
containerClassName = "",
} = props;
// Filter enabled options
const enabledOptions = options.filter((option) => option.enabled !== false);
if (enabledOptions.length === 0) return null;
return (
<div className={cn("w-full", containerClassName)}>
<div
className={cn(
"flex gap-4 overflow-hidden transition-all duration-500 ease-in-out",
compact ? "flex-row" : "flex-col",
className
)}
>
{enabledOptions.map((option) => (
<OAuthButton
key={option.id}
text={option.text}
icon={option.icon}
onClick={option.onClick}
compact={compact}
className="transition-all duration-300 ease-in-out"
/>
))}
</div>
{showDivider && (
<div className="mt-4 flex items-center transition-all duration-300">
<hr className="w-full border-strong transition-colors duration-300" />
<p className="mx-3 flex-shrink-0 text-center text-13 text-placeholder transition-colors duration-300">
{dividerLabel}
</p>
<hr className="w-full border-strong transition-colors duration-300" />
</div>
)}
</div>
);
}