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

feat(www): change style to filled fields to stay consistent with other text fields #1751

Merged
merged 6 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
17 changes: 7 additions & 10 deletions src/www/ui_components/server-rename-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,27 @@
limitations under the License.
*/

import '@material/mwc-textfield';
import {Polymer} from '@polymer/polymer/lib/legacy/polymer-fn.js';
import {html} from '@polymer/polymer/lib/utils/html-tag.js';
import {afterNextRender} from '@polymer/polymer/lib/utils/render-status.js';

Polymer({
_template: html`
<style>
h3 {
margin-bottom: 0;
}
paper-input {
mwc-textfield {
margin-top: 0;
--paper-input-container-focus-color: var(--medium-green);
}
</style>
<paper-dialog id="renameDialog" with-backdrop="">
<h3>[[localize('server-rename')]]</h3>
<paper-input id="serverNameInput" always-float-label="" maxlength="100" tabindex="0"></paper-input>
<mwc-textfield id="serverNameInput" maxlength="100" tabindex="0"></mwc-textfield>
<div class="buttons">
<paper-button dialog-dismiss="">[[localize('cancel')]]</paper-button>
<paper-button dialog-confirm="" on-tap="_saveRename">[[localize('save')]]</paper-button>
</div>
</paper-dialog>
`,
`,

is: 'server-rename-dialog',

Expand All @@ -50,7 +47,7 @@
__serverId: String,
},

open: function(serverName, serverId) {
open: function (serverName, serverId) {

Check warning on line 50 in src/www/ui_components/server-rename-dialog.js

View check run for this annotation

Codecov / codecov/patch

src/www/ui_components/server-rename-dialog.js#L50

Added line #L50 was not covered by tests
// Store the initial serverName so we can know if it changed, and
// store the serverId so we can emit the rename request event.
this.__serverName = serverName;
Expand All @@ -63,10 +60,10 @@
});
},

_saveRename: function() {
_saveRename: function () {

Check warning on line 63 in src/www/ui_components/server-rename-dialog.js

View check run for this annotation

Codecov / codecov/patch

src/www/ui_components/server-rename-dialog.js#L63

Added line #L63 was not covered by tests
const newName = this.$.serverNameInput.value;
if (newName !== this.__serverName) {
this.fire('RenameRequested', {serverId: this.__serverId, newName: newName});
}
}
},
});
8 changes: 4 additions & 4 deletions src/www/views/contact_view/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('ContactView client variant', () => {
radioButton.click();
await nextFrame();

const exitCard = el.shadowRoot!.querySelector('outline-card.exit')!;
const exitCard = el.shadowRoot!.querySelector('.exit')!;
expect(exitCard.textContent).toContain('experiencing high support volume');
});

Expand All @@ -68,7 +68,7 @@ describe('ContactView client variant', () => {
el.reset();
await nextFrame();

const exitCard = el.shadowRoot!.querySelector('outline-card.exit')!;
const exitCard = el.shadowRoot!.querySelector('.exit')!;
expect(exitCard).toBeNull();
});

Expand Down Expand Up @@ -128,7 +128,7 @@ describe('ContactView client variant', () => {
issue.click();
await nextFrame();

const exitCard = el.shadowRoot!.querySelector('outline-card.exit')!;
const exitCard = el.shadowRoot!.querySelector('.exit')!;
expect(exitCard.textContent).toContain(expectedMsg);
});
}
Expand Down Expand Up @@ -190,7 +190,7 @@ describe('ContactView client variant', () => {

await nextFrame();

expect(el.shadowRoot?.querySelector('h1')?.textContent).toContain('Tell us how we can help.');
expect(el.shadowRoot?.querySelector('p.intro')?.textContent).toContain('Tell us how we can help.');
expect(el.shadowRoot?.querySelector('support-form')).toBeNull();
});
});
Expand Down
99 changes: 49 additions & 50 deletions src/www/views/contact_view/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {Radio} from '@material/mwc-radio';
import {SingleSelectedEvent} from '@material/mwc-list/mwc-list';

import './support_form';
import {CardType} from '../shared/card';
import {IssueType, UNSUPPORTED_ISSUE_TYPE_HELPPAGES} from './issue_type';
import {AppType} from './app_type';
import {FormValues, SupportForm, ValidFormValues} from './support_form';
Expand All @@ -45,15 +44,20 @@ export class ContactView extends LitElement {
static styles = [
css`
:host {
background: #fff;
color: var(--outline-text-color);
display: block;
font-family: var(--outline-font-family);
margin: 0 auto;
max-width: var(--contact-view-max-width);
padding: var(--contact-view-gutter, var(--outline-gutter));
width: 100%;
}

:host > * {
sbruens marked this conversation as resolved.
Show resolved Hide resolved
display: block;
margin-left: auto;
margin-right: auto;
max-width: var(--contact-view-max-width);
}

mwc-circular-progress {
left: 50%;
position: absolute;
Expand All @@ -66,17 +70,13 @@ export class ContactView extends LitElement {
margin-bottom: var(--contact-view-gutter, var(--outline-gutter));
}

outline-card {
width: 100%;
}

p {
margin-top: .25rem;
}

ol {
list-style-type: none;
margin: .25rem 0;
margin: 1.5rem 0;
padding-inline-start: 0;
}

Expand All @@ -89,8 +89,9 @@ export class ContactView extends LitElement {
* this issue.
*/
--mdc-menu-max-height: 200px;
--mdc-menu-max-width: calc(100vw - calc(var(--outline-gutter) * 4));
--mdc-menu-max-width: min(calc(100vw - calc(var(--outline-gutter) * 4)), var(--contact-view-max-width));
margin-top: 1rem;
max-width: var(--contact-view-max-width);
width: 100%;
}

Expand All @@ -99,6 +100,7 @@ export class ContactView extends LitElement {
}

mwc-list-item {
line-height: 1.25rem;
/**
* The default styling of list items that wrap to 3+ lines is bad, and
* our items here are quite long and tend to wrap that much. To allow
Expand Down Expand Up @@ -231,7 +233,7 @@ export class ContactView extends LitElement {
}

private get renderIntroTemplate(): TemplateResult {
return html`<h1 class="intro">${this.localize('contact-view-intro')}</h1>`;
return html`<p class="intro">${this.localize('contact-view-intro')}</p>`;
}

private get renderForm(): TemplateResult | typeof nothing {
Expand Down Expand Up @@ -260,52 +262,49 @@ export class ContactView extends LitElement {
}

case Step.EXIT: {
return html` <outline-card class="exit" .type=${CardType.Elevated}> ${this.exitTemplate} </outline-card> `;
return html` <p class="exit">${this.exitTemplate}</p>`;
}

case Step.ISSUE_WIZARD:
default: {
return html`
${this.renderIntroTemplate}

<outline-card .type=${CardType.Elevated}>
<p>${this.localize('contact-view-open-ticket')}</p>

<ol>
${this.openTicketSelectionOptions.map(
element => html`
<li>
<mwc-formfield .label=${this.localize(element.labelMsg)}>
<mwc-radio
name="open-ticket"
.value="${element.value}"
required
@change=${this.selectHasOpenTicket}
${ref(element.ref)}
>
</mwc-radio>
</mwc-formfield>
</li>
`
)}
</ol>

<mwc-select
.label=${this.localize('contact-view-issue')}
outlined
?hidden=${!this.showIssueSelector}
?fixedMenuPosition=${true}
@selected="${this.selectIssue}"
>
${ContactView.ISSUES[this.variant].map(value => {
return html`
<mwc-list-item value="${value}">
<span>${this.localize(`contact-view-issue-${value}`)}</span>
</mwc-list-item>
`;
})}
</mwc-select>
</outline-card>
<p>${this.localize('contact-view-open-ticket')}</p>

<ol>
${this.openTicketSelectionOptions.map(
element => html`
<li>
<mwc-formfield .label=${this.localize(element.labelMsg)}>
<mwc-radio
name="open-ticket"
.value="${element.value}"
required
@change=${this.selectHasOpenTicket}
${ref(element.ref)}
>
</mwc-radio>
</mwc-formfield>
</li>
`
)}
</ol>

<mwc-select
.label=${this.localize('contact-view-issue')}
?hidden=${!this.showIssueSelector}
?fixedMenuPosition=${true}
@selected="${this.selectIssue}"
>
${ContactView.ISSUES[this.variant].map(value => {
return html`
<mwc-list-item value="${value}">
<span>${this.localize(`contact-view-issue-${value}`)}</span>
</mwc-list-item>
`;
})}
</mwc-select>
`;
}
}
Expand Down
Loading
Loading