Skip to content
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

chore(3000): remove buttons helper #19510

Merged
merged 1 commit into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { combineUrl, router } from 'kea-router'
import { SSO_PROVIDER_NAMES } from 'lib/constants'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { LemonDivider } from 'lib/lemon-ui/LemonDivider'
import { useButtonStyle } from 'scenes/authentication/useButtonStyles'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'

import { SSOProvider } from '~/types'
Expand Down Expand Up @@ -116,7 +115,6 @@ interface SSOEnforcedLoginButtonProps {
}

export function SSOEnforcedLoginButton({ provider, email }: SSOEnforcedLoginButtonProps): JSX.Element {
const buttonStyles = useButtonStyle()
return (
<SocialLoginLink provider={provider} extraQueryParams={{ email }}>
<LemonButton
Expand All @@ -127,7 +125,8 @@ export function SSOEnforcedLoginButton({ provider, email }: SSOEnforcedLoginButt
fullWidth
center
icon={SocialLoginIcon(provider)}
{...buttonStyles}
status="primary-alt"
size="large"
>
Log in with {SSO_PROVIDER_NAMES[provider]}
</LemonButton>
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/scenes/authentication/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { loginLogic } from './loginLogic'
import { redirectIfLoggedInOtherInstance } from './redirectToLoggedInInstance'
import RegionSelect from './RegionSelect'
import { SupportModalButton } from './SupportModalButton'
import { useButtonStyle } from './useButtonStyles'

export const ERROR_MESSAGES: Record<string, string | JSX.Element> = {
no_new_organizations:
Expand Down Expand Up @@ -58,7 +57,6 @@ export function Login(): JSX.Element {

const passwordInputRef = useRef<HTMLInputElement>(null)
const isPasswordHidden = precheckResponse.status === 'pending' || precheckResponse.sso_enforcement
const buttonStyles = useButtonStyle()

useEffect(() => {
if (preflight?.cloud) {
Expand Down Expand Up @@ -150,7 +148,8 @@ export function Login(): JSX.Element {
type="primary"
center
loading={isLoginSubmitting || precheckResponseLoading}
{...buttonStyles}
status="primary-alt"
size="large"
>
Log in
</LemonButton>
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/scenes/authentication/Login2FA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'

import { login2FALogic } from './login2FALogic'
import { useButtonStyle } from './useButtonStyles'

export function Login2FA(): JSX.Element {
const { isTwofactortokenSubmitting, generalError } = useValues(login2FALogic)
const { preflight } = useValues(preflightLogic)
const buttonStyles = useButtonStyle()

return (
<BridgePage
Expand Down Expand Up @@ -48,7 +46,8 @@ export function Login2FA(): JSX.Element {
type="primary"
center
loading={isTwofactortokenSubmitting}
{...buttonStyles}
status="primary-alt"
size="large"
>
Login
</LemonButton>
Expand Down
13 changes: 6 additions & 7 deletions frontend/src/scenes/authentication/PasswordReset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { SceneExport } from 'scenes/sceneTypes'

import { passwordResetLogic } from './passwordResetLogic'
import { SupportModalButton } from './SupportModalButton'
import { useButtonStyle } from './useButtonStyles'

export const scene: SceneExport = {
component: PasswordReset,
Expand Down Expand Up @@ -87,7 +86,6 @@ function EmailUnavailable(): JSX.Element {

function ResetForm(): JSX.Element {
const { isRequestPasswordResetSubmitting } = useValues(passwordResetLogic)
const buttonStyles = useButtonStyle()

return (
<Form logic={passwordResetLogic} formKey={'requestPasswordReset'} className="space-y-4" enableFormOnSubmit>
Expand All @@ -111,7 +109,8 @@ function ResetForm(): JSX.Element {
htmlType="submit"
data-attr="password-reset"
loading={isRequestPasswordResetSubmitting}
{...buttonStyles}
status="primary-alt"
size="large"
>
Continue
</LemonButton>
Expand All @@ -122,7 +121,6 @@ function ResetForm(): JSX.Element {
function ResetSuccess(): JSX.Element {
const { requestPasswordReset } = useValues(passwordResetLogic)
const { push } = useActions(router)
const buttonStyles = useButtonStyle()

return (
<div className="text-center">
Expand All @@ -135,7 +133,8 @@ function ResetSuccess(): JSX.Element {
center
fullWidth
onClick={() => push('/login')}
{...buttonStyles}
status="primary-alt"
size="large"
>
Back to login
</LemonButton>
Expand All @@ -147,7 +146,6 @@ function ResetSuccess(): JSX.Element {
function ResetThrottled(): JSX.Element {
const { requestPasswordReset } = useValues(passwordResetLogic)
const { push } = useActions(router)
const buttonStyles = useButtonStyle()

return (
<div className="text-center">
Expand All @@ -164,7 +162,8 @@ function ResetThrottled(): JSX.Element {
center
fullWidth
onClick={() => push('/login')}
{...buttonStyles}
status="primary-alt"
size="large"
>
Back to login
</LemonButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { SocialLoginButtons } from 'lib/components/SocialLoginButton/SocialLogin
import { Field } from 'lib/forms/Field'
import { Link } from 'lib/lemon-ui/Link'
import { useEffect, useRef } from 'react'
import { useButtonStyle } from 'scenes/authentication/useButtonStyles'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'

import { signupLogic } from '../signupLogic'
Expand All @@ -15,7 +14,6 @@ export function SignupPanel1(): JSX.Element | null {
const { preflight } = useValues(preflightLogic)
const { isSignupPanel1Submitting, signupPanel1 } = useValues(signupLogic)
const emailInputRef = useRef<HTMLInputElement | null>(null)
const buttonStyles = useButtonStyle()

useEffect(() => {
// There's no password in the demo environment
Expand Down Expand Up @@ -74,7 +72,8 @@ export function SignupPanel1(): JSX.Element | null {
data-attr="signup-start"
loading={isSignupPanel1Submitting}
disabled={isSignupPanel1Submitting}
{...buttonStyles}
status="primary-alt"
size="large"
>
Continue
</LemonButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Form } from 'kea-forms'
import SignupReferralSource from 'lib/components/SignupReferralSource'
import SignupRoleSelect from 'lib/components/SignupRoleSelect'
import { Field } from 'lib/forms/Field'
import { useButtonStyle } from 'scenes/authentication/useButtonStyles'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'

import { signupLogic } from '../signupLogic'
Expand All @@ -14,7 +13,6 @@ const UTM_TAGS = 'utm_campaign=in-product&utm_tag=signup-header'
export function SignupPanel2(): JSX.Element | null {
const { preflight } = useValues(preflightLogic)
const { isSignupPanel2Submitting } = useValues(signupLogic)
const buttonStyles = useButtonStyle()

return (
<div className="space-y-4 Signup__panel__2">
Expand Down Expand Up @@ -47,7 +45,8 @@ export function SignupPanel2(): JSX.Element | null {
data-attr="signup-submit"
loading={isSignupPanel2Submitting}
disabled={isSignupPanel2Submitting}
{...buttonStyles}
status="primary-alt"
size="large"
>
{!preflight?.demo
? 'Create account'
Expand Down
7 changes: 0 additions & 7 deletions frontend/src/scenes/authentication/useButtonStyles.ts

This file was deleted.

Loading