Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show helper text when supplied to survey component #3925

Merged
merged 3 commits into from
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions assets/js/components/surveys/SurveyQuestionOpenText.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ const SurveyQuestionOpenText = ( {
<label htmlFor={ instanceID }>{ placeholder }</label>
</VisuallyHidden>
<TextField
name="open-text"
helperText={ <HelperText>{ subtitle }</HelperText> }
name={ `survey-opentext-${ instanceID }` }
helperText={
subtitle ? (
<HelperText persistent>{ subtitle }</HelperText>
) : undefined
}
onChange={ onChange }
label={ placeholder }
noLabel
Expand Down
20 changes: 11 additions & 9 deletions assets/sass/components/surveys/_googlesitekit-surveys.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@
border-radius: 8px;
// The following is the same shadow used by surveys in
// other Google services so we're using the same style here.
box-shadow: rgb(0 0 0 / 14%) 0 16px 24px 2px, rgb(0 0 0 / 12%) 0 6px 30px 5px, rgb(0 0 0 / 20%) 0 8px 10px -5px;
box-shadow:
rgb(0 0 0 / 14%) 0 16px 24px 2px,
rgb(0 0 0 / 12%) 0 6px 30px 5px,
rgb(0 0 0 / 20%) 0 8px 10px -5px;
max-width: 400px;

@media (max-width: $bp-xsmallOnly) {
@media ( max-width: $bp-xsmallOnly ) {
max-width: none;
}
}
Expand All @@ -35,7 +38,7 @@
padding: 0 0 $grid-gap-phone;
position: relative;

@media (min-width: $bp-desktop) {
@media ( min-width: $bp-desktop ) {
padding-bottom: $grid-gap-desktop;
}
}
Expand Down Expand Up @@ -76,7 +79,7 @@
position: relative;
text-align: right;

@media (min-width: $bp-desktop) {
@media ( min-width: $bp-desktop ) {
padding: 0 $grid-gap-desktop $grid-gap-desktop;
}

Expand All @@ -94,7 +97,7 @@
margin: 0;
padding-top: 12px;

@media (min-width: $bp-desktop) {
@media ( min-width: $bp-desktop ) {
margin: 0 0 -12px;
}

Expand Down Expand Up @@ -123,7 +126,7 @@
&:first-child {
margin-left: 8px;

@media (min-width: $bp-desktop) {
@media ( min-width: $bp-desktop ) {
margin-left: 15px;
}

Expand All @@ -135,7 +138,7 @@
&:last-child {
margin-right: 7px;

@media (min-width: $bp-desktop) {
@media ( min-width: $bp-desktop ) {
margin-right: 17px;
}

Expand Down Expand Up @@ -172,10 +175,9 @@
.googlesitekit-survey__multi-select {

.googlesitekit-survey__body {

padding: $grid-gap-phone;

@media (min-width: $bp-desktop) {
@media ( min-width: $bp-desktop ) {
padding: $grid-gap-phone $grid-gap-desktop;
}
}
Expand Down
13 changes: 7 additions & 6 deletions assets/sass/widgets/_widgets.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
&__header {
border-bottom: 1px solid $c-border-light;

@media (min-width: $bp-tablet) {
@media ( min-width: $bp-tablet ) {
display: flex;
justify-content: space-between;
}
Expand All @@ -50,9 +50,9 @@
&__body,
&__footer {

@each $size in map-keys($mdc-layout-grid-columns) {
@each $size in map-keys( $mdc-layout-grid-columns ) {

@include mdc-layout-grid-media-query_($size) {
@include mdc-layout-grid-media-query_( $size ) {
$margin: map-get($mdc-layout-grid-default-margin, $size);

padding: $margin;
Expand All @@ -62,7 +62,8 @@
}

.googlesitekit-widget-area--composite & {
// Background, shadow, and padding are applied to entire widget area instead.
// Background, shadow, and padding are applied to entire widget
// area instead.
background: transparent;
box-shadow: none;

Expand Down Expand Up @@ -95,15 +96,15 @@
.googlesitekit-widget__header--cta {
margin: $grid-gap-phone 0 0;

@media (min-width: $bp-tablet) {
@media ( min-width: $bp-tablet ) {
margin: 0;
}

.googlesitekit-cta-link {
font-size: 15px;
font-weight: $fw-primary-normal;

@media (min-width: $bp-tablet) {
@media ( min-width: $bp-tablet ) {
font-size: 16px;
}
}
Expand Down