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

MWPW-164492 Plans Card Authoring v0.1 #156

Merged
merged 14 commits into from
Feb 13, 2025
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ config.json
MerchAtScale-*.json
.env*
.aio

8 changes: 4 additions & 4 deletions studio/src/editor-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,10 @@ export default class EditorPanel extends LitElement {
this.inEdit.updateFieldInternal(fieldName, value);
}

updateFragment(event) {
const fieldName = event.target.dataset.field;
let value = event.target.value || event.detail?.value;
value = event.target.multiline ? value?.split(',') : [value ?? ''];
updateFragment({ target, detail }) {
const fieldName = target.dataset.field;
let value = target.value || detail?.value || target.checked;
value = target.multiline ? value?.split(',') : [value ?? ''];
this.inEdit.updateField(fieldName, value);
}

Expand Down
33 changes: 32 additions & 1 deletion studio/src/editors/merch-card-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,23 @@ class MerchCardEditor extends LitElement {
<sp-field-label for="prices">Prices</sp-field-label>
<rte-field
id="prices"
inline
data-field="prices"
default-link-style="primary-outline"
@change="${this.updateFragment}"
>${unsafeHTML(form.prices.values[0])}</rte-field
>
</sp-field-group>
<sp-field-group class="toggle" id="promoText">
<sp-field-label for="promo-text">Promo Text</sp-field-label>
<sp-textfield
placeholder="Enter promo text"
id="promo-text"
data-field="promoText"
value="${form.promoText?.values[0]}"
@input="${this.updateFragment}"
?disabled=${this.disabled}
></sp-textfield>
</sp-field-group>
<sp-field-group class="toggle" id="description">
<sp-field-label for="description">Description</sp-field-label>
<rte-field
Expand All @@ -207,6 +217,27 @@ class MerchCardEditor extends LitElement {
>${unsafeHTML(form.description.values[0])}</rte-field
>
</sp-field-group>
<sp-field-group class="toggle" id="callout">
<sp-field-label for="callout"> Callout text </sp-field-label>
<rte-field
id="callout"
link
data-field="callout"
default-link-style="secondary-link"
@change="${this.updateFragment}"
?readonly=${this.disabled}
>${unsafeHTML(form.callout?.values[0])}</rte-field
>
</sp-field-group>
<sp-checkbox
size="m"
data-field="showStockCheckbox"
value="${form.showStockCheckbox?.values[0]}"
.checked="${form.showStockCheckbox?.values[0]}"
@change="${this.updateFragment}"
?disabled=${this.disabled}
>Stock Checkbox</sp-checkbox
>
<sp-field-group class="toggle" id="ctas">
<sp-field-label for="ctas">Footer</sp-field-label>
<rte-field
Expand Down
1 change: 1 addition & 0 deletions studio/src/editors/variant-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { html, LitElement } from 'lit';
export const VARIANTS = [
{ label: 'All', value: 'all', surface: 'all' },
{ label: 'Catalog', value: 'catalog', surface: 'acom' },
{ label: 'Plans', value: 'plans', surface: 'acom' },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plan without s? a card is a plan i think

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its plans

{ label: 'Slice', value: 'ccd-slice', surface: 'ccd' },
{ label: 'Special offers', value: 'special-offers', surface: 'acom' },
{ label: 'Suggested', value: 'ccd-suggested', surface: 'ccd' },
Expand Down
1 change: 1 addition & 0 deletions studio/src/swc.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,4 @@ import '@spectrum-web-components/top-nav/sp-top-nav-item.js';
import '@spectrum-web-components/top-nav/sp-top-nav.js';
import '@spectrum-web-components/underlay/sp-underlay.js';
import '@spectrum-web-components/underlay/sp-underlay.js';
import '@spectrum-web-components/checkbox/sp-checkbox.js';
Loading