Implement a `CurrentSurvey` component
See original GitHub issueFeature Description
The CurrentSurvey component is the entrypoint for rendering the current survey (if any) for the user. It’s responsible for retreiving the current survey from the core/user data store and rendering it at the top-most level.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- A
CurrentSurveycomponent should be created as a functional, hook-based, connected component - It should be added to the
Rootcomponent so that it is rendered as part of every React app in Site Kit- A
userFeedbackfeature flag should be added and used to conditionally render theCurrentSurvey
- A
- Additionally,
CurrentSurveyshould only be rendered (or always returnnull) if the site is using the proxy (seeisUsingProxyincore/site) - It should use the
getCurrentSurveyselector added in #3355 to retrieve the survey to render from the datastore, if any- If none, it should render
null - If a survey object is returned, it should render a
Surveycomponent passing through the surveyquestionandcompletionasquestionsandcompletionsprops respectively (see #3380)- If
Surveyhas yet to be implemented, an empty/placeholder component can be scaffolded in its place
- If
- If none, it should render
- When rendering a survey, a React portal should be used to place the output as a direct child of the
<body>- Survey elements should always appear in a fixed position at the bottom right-hand corner of the screen (with some distance from the edge of the browser) as shown in the design
- Survey data and event handlers should be passed through to the rendered component as props as necessary
Implementation Brief
- Once #3355 have been merged.
- Create new file
assets/js/components/surveys/CurrentSurveywhich exports theCurrentSurveyfunctional component. - Update the
Rootcomponent,- to conditionally render the
CurrentSurveycomponent if theuserFeedbackfeature flag is enabled by using theuseFeaturehook.
- to conditionally render the
- Using the
CurrentSurveycomponent,- Using the
useMounthook, check if the site is connected via the proxy by querying thecore/sitedata store via theisUsingProxyselector. If this is not the case, then rendernull. - Query the
core/userdata store via thegetCurrentSurveyselector and use the logic defined in the AC if there is none or a survey returned.
- Using the
- Styling the
CurrentSurveyconsists of only positioning the component to the bottom right of the user’s screen with a36pxspacing on the right and bottom. Child components rendered byCurrentSurveywill have their own styles. - Rename the
Modalcomponent toPortaland update references to theModalcomponent to usePortal.- Add the
slugoptional prop which will should be added as class name to the dynamically generated element so that is easy to identify the portal for styling purposes. If a slug is provided, then the class name will be prefixed bygooglesitekit-portal-and then the slug is appended.
- Add the
- Within the
CurrentSurveycomponent, usePortalto render the markup with theslugof the portal set tosurvey. - All styles for the
CurrentSurveycomponent should go inassets/sass/components/survey/_googlesitekit-survey.scss. - Any class names used in the component should follow the BEM methodology, with the
googlesitekit-surveyprefix.
Test Coverage
- No new tests to be added.
Visual Regression Changes
- N/A
QA Brief
- Run storybook locally via the
npm run storybookcommand. - Visit the
Components -> Surveys -> CurrentSurveystory. - Inspect the code and ensure that we have an element with the following class names:
googlesitekit-portal-survey googlesitekit-pluginas a direct child ofbody. Scaffolded Survey componentshould be displayed to the bottom right of the page.
Changelog entry
- Implement a component to render the current survey.
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
What is a current survey? - NOAA's National Ocean Service
To collect the data they need, NOAA scientists typically deploy Acoustic Doppler Current Profilers (ADCPs) to measure currents throughout the water column at ......
Read more >set_survey_vars: Set the variables for the current survey variable in ...
This function helps convert a vector to a variable in the correct part of a survey object's structure so that functions can refer...
Read more >Survey Components - Completions (C)
Data collected include: Completions by field of study, award level, recipient race/ethnicity and gender;; Completers by race/ethnicity, gender, and age ( ...
Read more >To Create a Curve in the Current Survey Figure | Civil 3D 2020 ...
Create a curve in the current figure using two known variables. In Toolspace, on the Survey tab, right-click a named network Survey Command...
Read more >Quotas - Qualtrics
Using Quotas in Other Parts of Qualtrics. In addition to specifying what happens to respondents in the quota editor, you can also use...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@aaemnnosttv I may have incorrectly phrased it in the IB but that’s what I meant when I said:
+1 for the suggested class name. IB updated.
@felixarntz ready for another pass 👍