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(app): Allow skipping night-aware class for TextField #3228

Merged
merged 1 commit into from
Dec 12, 2024
Merged
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
6 changes: 5 additions & 1 deletion weave-js/src/components/Form/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type TextFieldProps = {
dataTest?: string;
step?: number;
variant?: 'default' | 'ghost';
isContainerNightAware?: boolean;
};

export const TextField = ({
Expand All @@ -59,6 +60,7 @@ export const TextField = ({
autoComplete,
dataTest,
step,
isContainerNightAware,
}: TextFieldProps) => {
const textFieldSize = size ?? 'medium';
const leftPaddingForIcon = textFieldSize === 'medium' ? 'pl-34' : 'pl-36';
Expand All @@ -83,7 +85,6 @@ export const TextField = ({
<Tailwind style={{width: '100%'}}>
<div
className={classNames(
'night-aware',
'relative rounded-sm',
textFieldSize === 'medium' ? 'h-32' : 'h-40',
'bg-white dark:bg-moon-900',
Expand All @@ -93,6 +94,9 @@ export const TextField = ({
variant === 'ghost' &&
'outline outline-1 outline-transparent dark:outline-transparent',
{
// must not add "night-aware" class if already in a night-aware
// container, otherwise they'll cancel each other out
'night-aware': !isContainerNightAware,
'hover:outline-2 [&:hover:not(:focus-within)]:outline-[#83E4EB] dark:[&:hover:not(:focus-within)]:outline-teal-650':
!errorState && variant === 'default',
'focus-within:outline-2 focus-within:outline-teal-400 dark:focus-within:outline-teal-600':
Expand Down
Loading