Skip to content

Commit 9a25482

Browse files
authored
Merge pull request #576 from UTDNebula/fix/analytics-wrapper
Docs for analytics wrapper and add className to child components
2 parents a352a77 + 357c9a0 commit 9a25482

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/components/common/AnalyticsWrapper.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import React from 'react';
22

3+
/**
4+
* Wrapper component that injects ``analyticsClass`` class into its child
5+
*
6+
* Errors when more than 1 child
7+
*
8+
* Child component must take ``className`` props
9+
*/
310
export default function AnalyticsWrapper({
411
analyticsClass,
512
children,

src/components/home/Home.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,14 @@ export default function PlansPage(): JSX.Element {
183183
);
184184
}
185185

186-
interface ItemProps {
186+
interface ItemProps extends DropdownMenu.DropdownMenuItemProps {
187187
text: string;
188188
onClick: () => void;
189189
}
190-
const DropdownItem = ({ text, onClick, ...props }: ItemProps) => (
190+
const DropdownItem = ({ text, onClick, className = '', ...props }: ItemProps) => (
191191
<DropdownMenu.Item
192192
onClick={onClick}
193-
className="flex w-full min-w-max cursor-pointer items-center gap-x-3 border-b border-neutral-300 px-2 py-2 text-sm hover:bg-neutral-200"
193+
className={`flex w-full min-w-max cursor-pointer items-center gap-x-3 border-b border-neutral-300 px-2 py-2 text-sm hover:bg-neutral-200 ${className}`}
194194
{...props}
195195
>
196196
<span className="h-full w-full">{text}</span>

0 commit comments

Comments
 (0)