-
Notifications
You must be signed in to change notification settings - Fork 0
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
5874a20
commit b43a940
Showing
12 changed files
with
154 additions
and
353 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,3 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} |
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,38 @@ | ||
import { ZendeskContextValues, useZendesk } from "react-use-zendesk"; | ||
import styles from "../page.module.css"; | ||
|
||
export interface ExampleProps { | ||
id: string; | ||
title: string; | ||
description: React.ReactNode; | ||
buttonText: string; | ||
onClick: (hook: ZendeskContextValues) => void; | ||
} | ||
|
||
export const Example: React.FC<ExampleProps> = ({ | ||
title, | ||
description, | ||
buttonText, | ||
onClick, | ||
}) => { | ||
const hook = useZendesk(); | ||
|
||
function handleClick() { | ||
onClick(hook); | ||
} | ||
|
||
return ( | ||
<section className={styles.section}> | ||
<div className={styles.title}>{title}</div> | ||
<div className={styles.grid}> | ||
<div>{description}</div> | ||
|
||
<div> | ||
<button className={styles.button} onClick={handleClick}> | ||
{buttonText} | ||
</button> | ||
</div> | ||
</div> | ||
</section> | ||
); | ||
}; |
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,53 @@ | ||
import { Example, ExampleProps } from "./Example"; | ||
|
||
export const ExampleList = () => { | ||
const examples: ExampleProps[] = [ | ||
{ | ||
id: "messenger show", | ||
title: "Show", | ||
description: ( | ||
<div> | ||
Displays the widget on the host page in the state it was in before it | ||
was hidden. The widget is displayed by default on page load. You don't | ||
need to call <code>show</code> to display the widget unless you use{" "} | ||
<code>hide.</code> | ||
</div> | ||
), | ||
buttonText: "show", | ||
onClick: ({ show }) => { | ||
show(); | ||
}, | ||
}, | ||
{ | ||
id: "messenger hide", | ||
title: "Hide", | ||
description: ( | ||
<div> | ||
Hides all parts of the widget from the page. You can invoke it before | ||
or after page load. | ||
</div> | ||
), | ||
buttonText: "hide", | ||
onClick: ({ hide }) => { | ||
hide(); | ||
}, | ||
}, | ||
]; | ||
return ( | ||
<> | ||
{examples.map((example) => { | ||
const { title, description, onClick, buttonText, id } = example; | ||
return ( | ||
<Example | ||
id={id} | ||
key={id} | ||
title={title} | ||
description={description} | ||
onClick={onClick} | ||
buttonText={buttonText} | ||
/> | ||
); | ||
})} | ||
</> | ||
); | ||
}; |
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.