Skip to content

Commit

Permalink
chore(app): Allow skipping night-aware class for TextField
Browse files Browse the repository at this point in the history
  • Loading branch information
connieelee committed Dec 12, 2024
1 parent cdf6574 commit c483b4e
Showing 1 changed file with 5 additions and 1 deletion.
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

0 comments on commit c483b4e

Please sign in to comment.