-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* routes for survey templates * basic on click setup logic * Update UI snapshots for `chromium` (2) * import type * Apply suggestions from code review Co-authored-by: Joe Martin <[email protected]> * address feedback from cory * fix logic * remove unused logic file * Update frontend/src/scenes/surveys/constants.tsx Co-authored-by: Joe Martin <[email protected]> * Update frontend/src/scenes/surveys/constants.tsx Co-authored-by: Neil Kakkar <[email protected]> * address comments * Update UI snapshots for `chromium` (2) * more fixes * Update UI snapshots for `webkit` (2) * Update UI snapshots for `webkit` (2) * Update UI snapshots for `chromium` (2) * move description and title together * fix e2e --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Joe Martin <[email protected]> Co-authored-by: Neil Kakkar <[email protected]>
- Loading branch information
1 parent
938e391
commit 93e8ccc
Showing
13 changed files
with
233 additions
and
7 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
Binary file modified
BIN
+128 Bytes
(100%)
frontend/__snapshots__/scenes-app-surveys--surveys-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@import '../../styles/mixins'; | ||
|
||
.SurveyTemplateContainer { | ||
display: flex; | ||
align-items: center; | ||
border: 1px solid var(--border); | ||
border-radius: 6px; | ||
min-height: 300px; | ||
margin-top: 2px; | ||
|
||
&:hover { | ||
cursor: pointer; | ||
border-color: var(--primary-light); | ||
} | ||
|
||
.SurveyTemplate { | ||
-ms-transform: scale(0.8, 0.8); /* IE 9 */ | ||
-webkit-transform: scale(0.8, 0.8); /* Safari */ | ||
transform: scale(0.8, 0.8); | ||
} | ||
} |
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 { SceneExport } from 'scenes/sceneTypes' | ||
import { SurveyAppearance } from './SurveyAppearance' | ||
import { defaultSurveyTemplates } from './constants' | ||
import { SurveyQuestion } from '~/types' | ||
import './SurveyTemplates.scss' | ||
import { useActions } from 'kea' | ||
import { PageHeader } from 'lib/components/PageHeader' | ||
import { LemonButton } from '@posthog/lemon-ui' | ||
import { urls } from 'scenes/urls' | ||
import { surveyLogic } from './surveyLogic' | ||
|
||
export const scene: SceneExport = { | ||
component: SurveyTemplates, | ||
} | ||
|
||
export function SurveyTemplates(): JSX.Element { | ||
const { setSurveyTemplateValues } = useActions(surveyLogic({ id: 'new' })) | ||
|
||
return ( | ||
<> | ||
<PageHeader | ||
title={'New survey'} | ||
buttons={ | ||
<LemonButton type="primary" to={urls.survey('new')} data-attr="new-blank-survey"> | ||
Create blank survey | ||
</LemonButton> | ||
} | ||
/> | ||
<div className="flex flex-row flex-wrap gap-8 ml-8 mt-8"> | ||
{defaultSurveyTemplates.map((template, idx) => { | ||
return ( | ||
<div | ||
className="flex flex-col items-center" | ||
key={idx} | ||
onClick={() => | ||
setSurveyTemplateValues({ name: template.type, questions: template.questions }) | ||
} | ||
> | ||
<span className="mb-2 text-md"> | ||
<b>{template.type}</b> | ||
</span> | ||
<span className="flex flex-wrap text-xs text-muted max-w-80 font-medium mb-2"> | ||
{template.description} | ||
</span> | ||
<div className="SurveyTemplateContainer"> | ||
<div className="SurveyTemplate"> | ||
<SurveyAppearance | ||
key={idx} | ||
type={template.questions[0].type} | ||
question={template.questions[0].question} | ||
appearance={{ whiteLabel: true, ...template.appearance }} | ||
surveyQuestionItem={template.questions[0] as SurveyQuestion} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
})} | ||
</div> | ||
</> | ||
) | ||
} |
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