Skip to content

Commit

Permalink
fix: payment notice collaspible
Browse files Browse the repository at this point in the history
  • Loading branch information
tomquirk committed Jan 13, 2024
1 parent 511db7f commit 9776a82
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
12 changes: 3 additions & 9 deletions src/components/Callout/Callout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import {
ChevronDownIcon,
InformationCircleIcon,
} from '@heroicons/react/24/solid'
import { PropsWithChildren, useCallback, useState } from 'react'
import { PropsWithChildren, useState } from 'react'
import { twJoin, twMerge } from 'tailwind-merge'
import { classNames } from 'utils/classNames'
import { InfoCallout } from './InfoCallout'
import { WarningCallout } from './WarningCallout'

Expand All @@ -29,19 +28,14 @@ export const Callout: React.FC<React.PropsWithChildren<CalloutProps>> &
// Whether the callout is collapsed. Only relevant if collapsible is true.
const [expanded, setExpanded] = useState<boolean>(false)

// react callback handler to expand the callout text
const handleToggleExpand = useCallback(() => {
setExpanded(!expanded)
}, [expanded])

return (
<div
className={twMerge(
'flex items-start gap-4 rounded-lg p-4',
collapsible ? 'cursor-pointer select-none' : undefined,
className,
)}
onClick={collapsible ? handleToggleExpand : undefined}
onClick={collapsible ? () => setExpanded(!expanded) : undefined}
role={collapsible ? 'button' : undefined}
>
{iconComponent !== null && (
Expand All @@ -50,7 +44,7 @@ export const Callout: React.FC<React.PropsWithChildren<CalloutProps>> &
</span>
)}
<div
className={classNames(
className={twMerge(
'inline-block overflow-hidden overflow-ellipsis',
collapsible && !expanded ? 'whitespace-nowrap' : 'whitespace-normal',
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ export const MessageSection = () => {
className="mt-6 border border-bluebs-100 bg-bluebs-25 text-bluebs-700 dark:border-bluebs-800 dark:bg-bluebs-950 dark:text-bluebs-400"
iconComponent={<EnvelopeIcon className="h-6 w-6" />}
>
<div>
<>
<div className="font-medium text-bluebs-700 dark:text-bluebs-300">
<Trans>Notice from {projectName}</Trans>
</div>
<p className="mt-2 mb-0 whitespace-pre-wrap">
{projectPayDisclosure}
</p>
</div>
<p className="mt-2 mb-0">{projectPayDisclosure}</p>
</>
</Callout>
)}
</div>
Expand Down

1 comment on commit 9776a82

@vercel
Copy link

@vercel vercel bot commented on 9776a82 Jan 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.