Skip to content

Commit

Permalink
Merge branch 'main' into tailwind-admin-fields
Browse files Browse the repository at this point in the history
  • Loading branch information
cmegalo committed Jul 31, 2024
2 parents 672b796 + 221d196 commit b7fcedd
Show file tree
Hide file tree
Showing 131 changed files with 5,855 additions and 3,617 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ jobs:
- name: Lighthouse
uses: shopify/lighthouse-ci-action@v1
with:
app_id: ${{ secrets.SHOP_APP_ID }}
app_password: ${{ secrets.SHOP_APP_PASSWORD }}
access_token: ${{ secrets.SHOP_ACCESS_TOKEN }}
store: ${{ secrets.SHOP_STORE }}
password: ${{ secrets.SHOP_PASSWORD }}
lhci_github_app_token: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
Expand Down
7 changes: 5 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{
"editor.formatOnSave": false,
"[javascript]": {
"editor.formatOnSave": true
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[css]": {
"editor.formatOnSave": true
},
"[liquid]": {
"editor.defaultFormatter": "Shopify.theme-check-vscode",
"editor.formatOnSave": true
}
},
"themeCheck.checkOnSave": true
}
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Brought to you and maintained by [Trellis Commerce](https://trellis.co/) - A full-service eCommerce agency based in Boston, MA

Latest merged code from [Dawn v13.0.1](https://github.com/Shopify/dawn/releases/tag/v13.0.1)
Latest merged code from [Dawn v15.0.1](https://github.com/Shopify/dawn/releases/tag/v15.0.1)

# Dawn + Tailwind CSS + Prettier Shopify Starter Theme

Expand All @@ -20,6 +20,7 @@ The starter theme includes an integration of:
## Other Noted Modifications

- Set the default page width to 1440px and tweaked the desktop page width range to be 1200px to 1600px with a step adjustment of 10px (standard desktop width used at Trellis and allows for more fine tuning)
- There is a page template called `noindexnofollow` with the meta tag `noindex, nofollow` for any pages that need to be hidden from search engine site crawlers

## Steps to Start Using this Starter Theme

Expand Down Expand Up @@ -54,16 +55,9 @@ First, make sure your `Workflow permissions` are set like below in order for the

In your GitHub repo, navigate to Settings > Secrets > Actions and add the following repository secrets:

`SHOP_APP_ID` & `SHOP_APP_PASSWORD`
`SHOP_ACCESS_TOKEN`

- Get values by navigating to https://mystore.myshopify.com/admin/apps/development, select the theme kit app, and copy the API key value for `SHOP_APP_ID` & Admin API access token value for `SHOP_APP_PASSWORD` (value starts with shpat)
- Notes on how to get these values:

1. Navigate to the Apps section in your Shopify admin and click the Develop apps button in the top right
2. Then Allow custom app development
3. You should be able to click the Create an app button
4. In the configuration tab of your app, go ahead and check all the boxes for the Admin and Storefront API permissions
5. The API key & Admin API access token will be in the API credentials tab
- Settings > Apps and sales channels > Develop Apps > Create an app. Name it something like `Lighthouse` and give the app permissions of `read_products,write_themes`. Install the app and use the token value that will start with `shpat_`.

`SHOP_STORE`

Expand All @@ -88,7 +82,7 @@ In your GitHub repo, navigate to Settings > Secrets > Actions and add the follow

These secret values are used in the `ci.yml` GitHub workflow:

<img width="500" alt="Secrets shown in the workflow file" src="https://user-images.githubusercontent.com/75811975/162518733-c1744910-85b2-44e3-91d0-08acfc018ba1.png">
<img width="507" alt="Screenshot 2024-07-30 at 1 44 13 PM" src="https://github.com/user-attachments/assets/0c8f7af0-5a35-4cfe-b5e0-6ebcf7c86a41">

## Install [Shopify Liquid VSCode extension](https://marketplace.visualstudio.com/items?itemName=Shopify.theme-check-vscode)

Expand Down
137 changes: 128 additions & 9 deletions assets/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
--alpha-button-border: 1;
--alpha-link: 0.85;
--alpha-badge-border: 0.1;
--focused-base-outline: 0.2rem solid rgba(var(--color-foreground), 0.5);
--focused-base-outline-offset: 0.3rem;
--focused-base-box-shadow: 0 0 0 0.3rem rgb(var(--color-background)),
0 0 0.5rem 0.4rem rgba(var(--color-foreground), 0.3);
}

.product-card-wrapper .card,
Expand Down Expand Up @@ -264,8 +268,18 @@ h5,
word-break: break-word;
}

.hxxl {
font-size: clamp(
calc(var(--font-heading-scale) * 5.6rem),
14vw,
calc(var(--font-heading-scale) * 7.2rem)
);
line-height: 1.1;
}

.hxl {
font-size: calc(var(--font-heading-scale) * 5rem);
line-height: calc(1 + 0.3 / max(1, var(--font-heading-scale)));
}

@media only screen and (min-width: 750px) {
Expand Down Expand Up @@ -690,18 +704,16 @@ summary::-webkit-details-marker {
}

*:focus-visible {
outline: 0.2rem solid rgba(var(--color-foreground), 0.5);
outline-offset: 0.3rem;
box-shadow: 0 0 0 0.3rem rgb(var(--color-background)),
0 0 0.5rem 0.4rem rgba(var(--color-foreground), 0.3);
outline: var(--focused-base-outline);
outline-offset: var(--focused-base-outline-offset);
box-shadow: var(--focused-base-box-shadow);
}

/* Fallback - for browsers that don't support :focus-visible, a fallback is set for :focus */
.focused {
outline: 0.2rem solid rgba(var(--color-foreground), 0.5);
outline-offset: 0.3rem;
box-shadow: 0 0 0 0.3rem rgb(var(--color-background)),
0 0 0.5rem 0.4rem rgba(var(--color-foreground), 0.3);
outline: var(--focused-base-outline);
outline-offset: var(--focused-base-outline-offset);
box-shadow: var(--focused-base-box-shadow);
}

/*
Expand Down Expand Up @@ -2012,7 +2024,7 @@ input[type='checkbox'] {
position: relative;
}

product-info .loading__spinner:not(.hidden) ~ *,
.product__info-container .loading__spinner:not(.hidden) ~ *,
.quantity__rules-cart .loading__spinner:not(.hidden) ~ * {
visibility: hidden;
}
Expand Down Expand Up @@ -2571,6 +2583,14 @@ product-info .loading__spinner:not(.hidden) ~ *,
background: rgba(var(--color-foreground), 0.5);
}

.header__icon--account shop-user-avatar {
--shop-avatar-size: 2.8rem;
}

account-icon {
display: flex;
}

/* Search */
menu-drawer + .header__search {
display: none;
Expand Down Expand Up @@ -3525,3 +3545,102 @@ details-disclosure > details {
--border-offset: 0px; /* Prevent the border from growing on buttons when this effect is on. */
}
}

/* Loading spinner */
.loading__spinner {
position: absolute;
z-index: 1;
width: 1.8rem;
}

.loading__spinner {
width: 1.8rem;
display: inline-block;
}

.spinner {
animation: rotator 1.4s linear infinite;
}

@keyframes rotator {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(270deg);
}
}

.path {
stroke-dasharray: 280;
stroke-dashoffset: 0;
transform-origin: center;
stroke: rgb(var(--color-foreground));
animation: dash 1.4s ease-in-out infinite;
}

@media screen and (forced-colors: active) {
.path {
stroke: CanvasText;
}
}

@keyframes dash {
0% {
stroke-dashoffset: 280;
}
50% {
stroke-dashoffset: 75;
transform: rotate(135deg);
}
100% {
stroke-dashoffset: 280;
transform: rotate(450deg);
}
}

.loading__spinner:not(.hidden) + .cart-item__price-wrapper,
.loading__spinner:not(.hidden) ~ cart-remove-button {
opacity: 50%;
}

.loading__spinner:not(.hidden) ~ cart-remove-button {
pointer-events: none;
cursor: default;
}

/* Progress bar */
.progress-bar-container {
width: 100%;
margin: auto;
}

.progress-bar {
height: 0.13rem;
width: 100%;
}

.progress-bar-value {
width: 100%;
height: 100%;
background-color: rgb(var(--color-foreground));
animation: indeterminateAnimation var(--duration-extra-longer) infinite
ease-in-out;
transform-origin: 0;
}

.progress-bar .progress-bar-value {
display: block;
}

@keyframes indeterminateAnimation {
0% {
transform: translateX(-20%) scaleX(0);
}
40% {
transform: translateX(30%) scaleX(0.7);
}
100% {
transform: translateX(100%) scaleX(0);
}
}
4 changes: 4 additions & 0 deletions assets/cart-drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class CartDrawer extends HTMLElement {

setHeaderCartIconAccessibility() {
const cartLink = document.querySelector('#cart-icon-bubble');
if (!cartLink) return;

cartLink.setAttribute('role', 'button');
cartLink.setAttribute('aria-haspopup', 'dialog');
cartLink.addEventListener('click', (event) => {
Expand Down Expand Up @@ -91,6 +93,8 @@ class CartDrawer extends HTMLElement {
const sectionElement = section.selector
? document.querySelector(section.selector)
: document.getElementById(section.id);

if (!sectionElement) return;
sectionElement.innerHTML = this.getSectionInnerHTML(
parsedState.sections[section.id],
section.selector,
Expand Down
59 changes: 52 additions & 7 deletions assets/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,57 @@ class CartItems extends HTMLElement {
}
}

resetQuantityInput(id) {
const input = this.querySelector(`#Quantity-${id}`);
input.value = input.getAttribute('value');
this.isEnterPressed = false;
}

setValidity(event, index, message) {
event.target.setCustomValidity(message);
event.target.reportValidity();
this.resetQuantityInput(index);
event.target.select();
}

validateQuantity(event) {
const inputValue = parseInt(event.target.value);
const index = event.target.dataset.index;
let message = '';

if (inputValue < event.target.dataset.min) {
message = window.quickOrderListStrings.min_error.replace(
'[min]',
event.target.dataset.min,
);
} else if (inputValue > parseInt(event.target.max)) {
message = window.quickOrderListStrings.max_error.replace(
'[max]',
event.target.max,
);
} else if (inputValue % parseInt(event.target.step) !== 0) {
message = window.quickOrderListStrings.step_error.replace(
'[step]',
event.target.step,
);
}

if (message) {
this.setValidity(event, index, message);
} else {
event.target.setCustomValidity('');
event.target.reportValidity();
this.updateQuantity(
index,
inputValue,
document.activeElement.getAttribute('name'),
event.target.dataset.quantityVariantId,
);
}
}

onChange(event) {
this.updateQuantity(
event.target.dataset.index,
event.target.value,
document.activeElement.getAttribute('name'),
event.target.dataset.quantityVariantId,
);
this.validateQuantity(event);
}

onCartUpdate() {
Expand Down Expand Up @@ -235,7 +279,8 @@ class CartItems extends HTMLElement {
document.getElementById(`Line-item-error-${line}`) ||
document.getElementById(`CartDrawer-LineItemError-${line}`);
if (lineItemError)
lineItemError.querySelector('.cart-item__error-text').innerHTML = message;
lineItemError.querySelector('.cart-item__error-text').textContent =
message;

this.lineItemStatusElement.setAttribute('aria-hidden', true);

Expand Down
Loading

0 comments on commit b7fcedd

Please sign in to comment.