-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c24485
commit 35e25fc
Showing
36 changed files
with
418 additions
and
379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from "react"; | ||
|
||
import type { Decorator } from "@storybook/react"; | ||
import { fn } from "@storybook/test"; | ||
|
||
import { | ||
analyticsContext, | ||
type AnalyticsContext, | ||
} from "../../src/components/ContextProviders/AnalyticsProvider"; | ||
|
||
declare module "@storybook/csf" { | ||
interface Parameters { | ||
analyticsContext?: Partial<AnalyticsContext>; | ||
} | ||
} | ||
|
||
export const AnalyticsDecorator: Decorator = (Story, { parameters }) => { | ||
return ( | ||
<analyticsContext.Provider | ||
value={ | ||
{ | ||
track: fn(), | ||
trackEvent: fn(), | ||
identify: fn(), | ||
reset: fn(), | ||
page: fn(), | ||
posthogAiBetaClient: {}, | ||
...parameters.analyticsContext, | ||
} as unknown as AnalyticsContext | ||
} | ||
> | ||
<Story /> | ||
</analyticsContext.Provider> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from "react"; | ||
|
||
import type { Decorator } from "@storybook/react"; | ||
|
||
import { | ||
ChatContext, | ||
type ChatContextProps, | ||
} from "../../src/components/ContextProviders/ChatProvider"; | ||
|
||
declare module "@storybook/csf" { | ||
interface Parameters { | ||
chatContext?: Partial<ChatContextProps>; | ||
} | ||
} | ||
|
||
export const ChatDecorator: Decorator = (Story, { parameters }) => ( | ||
<ChatContext.Provider value={parameters.chatContext as ChatContextProps}> | ||
<Story /> | ||
</ChatContext.Provider> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import React from "react"; | ||
|
||
import type { Decorator } from "@storybook/react"; | ||
import invariant from "tiny-invariant"; | ||
|
||
import { | ||
DemoContext, | ||
type DemoContextProps, | ||
} from "@/components/ContextProviders/Demo"; | ||
|
||
declare module "@storybook/csf" { | ||
interface Parameters { | ||
demoContext?: DemoContextProps; | ||
} | ||
} | ||
|
||
export const DemoDecorator: Decorator = (Story, { parameters }) => { | ||
const value = parameters.demoContext; | ||
invariant( | ||
value, | ||
"DemoDecorator requires a DemoContext. Please call ...demoParams() in the parameters", | ||
); | ||
|
||
return ( | ||
<DemoContext.Provider value={value}> | ||
<Story /> | ||
</DemoContext.Provider> | ||
); | ||
}; | ||
|
||
const demoBase: DemoContextProps["demo"] = { | ||
appSessionsRemaining: 2, | ||
appSessionsPerMonth: 3, | ||
contactHref: "https://share.hsforms.com/1R9ulYSNPQgqElEHde3KdhAbvumd", | ||
}; | ||
|
||
type DemoParams = { | ||
isDemoUser: boolean; | ||
demo?: Partial<DemoContextProps["demo"]>; | ||
isSharingEnabled?: boolean; | ||
}; | ||
export const demoParams = ( | ||
args: DemoParams, | ||
): { demoContext: DemoContextProps } => { | ||
const isSharingEnabled = args.isSharingEnabled ?? true; | ||
|
||
const context: DemoContextProps = args.isDemoUser | ||
? { | ||
isDemoUser: true, | ||
demo: { ...demoBase, ...args.demo }, | ||
isSharingEnabled, | ||
} | ||
: { | ||
isDemoUser: false, | ||
demo: undefined, | ||
isSharingEnabled, | ||
}; | ||
|
||
return { | ||
demoContext: context, | ||
}; | ||
}; |
30 changes: 30 additions & 0 deletions
30
apps/nextjs/.storybook/decorators/DialogContentDecorator.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from "react"; | ||
|
||
import type { Decorator } from "@storybook/react"; | ||
import { fn } from "@storybook/test"; | ||
|
||
import type { DialogTypes } from "../../src/components/AppComponents/Chat/Chat/types"; | ||
import { DialogContext } from "../../src/components/AppComponents/DialogContext"; | ||
|
||
declare module "@storybook/csf" { | ||
interface Parameters { | ||
dialogWindow?: DialogTypes; | ||
} | ||
} | ||
|
||
export const DialogContentDecorator: Decorator = (Story, { parameters }) => { | ||
return ( | ||
<DialogContext.Provider | ||
value={{ | ||
dialogWindow: parameters.dialogWindow ?? "", | ||
setDialogWindow: fn(), | ||
dialogProps: {}, | ||
setDialogProps: fn(), | ||
openSidebar: false, | ||
setOpenSidebar: fn(), | ||
}} | ||
> | ||
<Story /> | ||
</DialogContext.Provider> | ||
); | ||
}; |
21 changes: 21 additions & 0 deletions
21
apps/nextjs/.storybook/decorators/LessonPlanTrackingDecorator.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from "react"; | ||
|
||
import type { Decorator } from "@storybook/react"; | ||
import { fn } from "@storybook/test"; | ||
|
||
import { LessonPlanTrackingContext } from "../../src/lib/analytics/lessonPlanTrackingContext"; | ||
|
||
export const LessonPlanTrackingDecorator: Decorator = (Story) => ( | ||
<LessonPlanTrackingContext.Provider | ||
value={{ | ||
onClickContinue: fn(), | ||
onClickRetry: fn(), | ||
onClickStartFromExample: fn(), | ||
onClickStartFromFreeText: fn(), | ||
onStreamFinished: fn(), | ||
onSubmitText: fn(), | ||
}} | ||
> | ||
<Story /> | ||
</LessonPlanTrackingContext.Provider> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from "react"; | ||
|
||
import type { Decorator } from "@storybook/react"; | ||
import { fn } from "@storybook/test"; | ||
|
||
import { SidebarContext } from "../../src/lib/hooks/use-sidebar"; | ||
|
||
declare module "@storybook/csf" { | ||
interface Parameters { | ||
// Please fill out as we add configuration | ||
sidebarContext?: {}; | ||
} | ||
} | ||
|
||
export const SidebarDecorator: Decorator = (Story) => ( | ||
<SidebarContext.Provider | ||
value={{ | ||
toggleSidebar: fn(), | ||
isLoading: false, | ||
isSidebarOpen: false, | ||
}} | ||
> | ||
<Story /> | ||
</SidebarContext.Provider> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
apps/nextjs/src/app/aila/[id]/download/DownloadView.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
apps/nextjs/src/app/legal/account-locked/account-locked.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.