-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add configurable typeforms. * Fix lint. * Add surveys to open and manage vault pages. * Use array to track closed surveys.
- Loading branch information
Showing
12 changed files
with
108 additions
and
66 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Global } from '@emotion/core' | ||
import { Popover, Sidetab } from '@typeform/embed-react' | ||
import { useLocalStorage } from 'helpers/useLocalStorage' | ||
import React from 'react' | ||
import { useBreakpointIndex } from 'theme/useBreakpointIndex' | ||
|
||
const typeformPopoverButton = '.tf-v1-popover .tf-v1-popover-button' | ||
|
||
type SurveyConfig = { id: string; title: string; color: string } | ||
|
||
export function SurveyButtons({ id, title, color }: SurveyConfig) { | ||
const breakpoint = useBreakpointIndex() | ||
|
||
const [closedSurveys, setClosedSurveys] = useLocalStorage('closed-surveys', []) | ||
const wasClosed = closedSurveys.includes(id) | ||
|
||
return ( | ||
<> | ||
{breakpoint <= 1 && !wasClosed && ( | ||
<> | ||
{breakpoint === 0 && ( | ||
<Global | ||
styles={() => ({ | ||
[typeformPopoverButton]: { | ||
bottom: '77px', | ||
right: '14px', | ||
}, | ||
})} | ||
/> | ||
)} | ||
|
||
<Popover | ||
id={id} | ||
buttonColor={color} | ||
shareGaInstance={true} | ||
onClose={() => setClosedSurveys([...closedSurveys, id])} | ||
/> | ||
</> | ||
)} | ||
{breakpoint > 1 && !wasClosed && ( | ||
<Sidetab | ||
id={id} | ||
buttonText={title} | ||
buttonColor={color} | ||
shareGaInstance={true} | ||
onClose={() => setClosedSurveys([...closedSurveys, id])} | ||
> | ||
{title} | ||
</Sidetab> | ||
)} | ||
</> | ||
) | ||
} |
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,10 @@ | ||
import React from 'react' | ||
|
||
import { SurveyButtons } from './SurveyButtons' | ||
import surveysConfig from './surveysConfig.json' | ||
|
||
export function Survey({ for: page }: { for: keyof typeof surveysConfig }) { | ||
const config = surveysConfig[page] | ||
|
||
return config.id ? <SurveyButtons {...config} /> : null | ||
} |
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,22 @@ | ||
{ | ||
"multiply": { | ||
"id": "H52MeocX", | ||
"title": "Help shape the future of Multiply", | ||
"color": "#575CFE" | ||
}, | ||
"earn": { | ||
"id": "", | ||
"title": "Help shape the future of Earn", | ||
"color": "#575CFE" | ||
}, | ||
"borrow": { | ||
"id": "", | ||
"title": "Help shape the future of Borrow", | ||
"color": "#575CFE" | ||
}, | ||
"homepage": { | ||
"id": "", | ||
"title": "Help shape the future of Oasis.app", | ||
"color": "#575CFE" | ||
} | ||
} |
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