Skip to content

Instantly share code, notes, and snippets.

View kyledurand's full-sized avatar
👋
🌝

Kyle Durand kyledurand

👋
🌝
View GitHub Profile
@kyledurand
kyledurand / PolarisButton.js
Created May 11, 2021 19:26
Polaris / base web
import {ThemeProvider as PolarisThemeProvider} from '@shopify/polaris';
import {spacingBase, spacingTight} from '@shopify/polaris-tokens';
import {createTheme, ThemeProvider} from 'baseui';
import {styled} from 'styletron-react';
import {Card} from 'baseui/card';
import {Button, KIND} from 'baseui/button';
const primitives = {
text: 'var(--p-text-on-primary)',

Consider performance early and often

  • Think about performance at the beginning of every project
  • Set a goal and baseline
  • Set trip wires to perform audits along the way

Cache where you can

  • Use memoize
function Badge(props) {};
{% comment %}
Start of Cash on Delivery pincode checker snippet
Instructions:
1. Copy and paste this snippet into the liquid template where you'd like it to be displayed.
i.e. product.liquid, cart.liquid etc...
2. Set title and messages below (optional).
3. Customize success and failure colors (optional).
4. Adjust the pixel spacing on line 19 to best match the surroundings of the snippet.
This will adjust spacing below the title and input field.
@kyledurand
kyledurand / Adding a search popup.md
Last active October 24, 2022 03:00
Adding a search box popup / modal to the Brooklyn Theme

Issue

Brooklyn doesn't have a search box by default and adding one to the header somewhat disrupts the aesthetic of the theme. Instead of adding just an icon linking to the search page, why not adding a modal using the already built in popup plugin?

image

Did you see that fade in?! It's actually very smooth IRL.

Steps:

@kyledurand
kyledurand / checkout.liquid
Last active May 10, 2020 22:23
Pre populating the billing address at checkout
{% if customer and customer.addresses[0].country %}
{{ '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js' | script_tag }}
<style>
.js .field--same-billing-address {
display: none !important;
}
#checkout_billing_address_country, #checkout_billing_address_province {
@kyledurand
kyledurand / Remove cropping from images in checkout.md
Created May 5, 2015 18:23
Removing 'cropped' from image src

This one is farily straight forward

    {{ '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js' | script_tag }}

    <script type="text/javascript">

      (function(window, undefined) {
        var $;
@kyledurand
kyledurand / Line Item Properties in Checkout.md
Last active August 29, 2015 14:19
Show Line Item Properties in Order Summary During Checkout

Issue

Some Plus merchants would like line item properties displayed in the order summary during checkout.

Solution (Requires checkout.liquid and a plus plan)

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<script type="text/javascript">
@kyledurand
kyledurand / instructions.md
Created April 6, 2015 17:17
Shopify Minimal Theme Sub Navigation (Nested) Menus

How do enable sub menus in the Minimal theme

  1. Replace the site-nav.liquid snippet with the one below.
  2. Add the css below to the bottom of styles.scss.liquid
  3. If you haven't already, create your sub linklists by folowing the same procedure as mentioned in this doc
  4. Result:

Alt text

@kyledurand
kyledurand / 1 Instructions.md
Last active August 29, 2015 14:14
Getting scripts to work on ajaxified cart drawers etc...

Getting scripts to work on ajaxified cart drawers etc...

  1. Move your script from wherever it is into theme.liquid
  2. Wrap it in a function
  3. Call the function
  4. Call the function again whenever ajax has loaded something.
  5. See example below. I've used the agree to terms of service snippet.
@kyledurand
kyledurand / styles.scss.liquid
Created January 23, 2015 15:54
[Lookbook] Header newsletter form with jquery success and error
div.contact * {display: inline-block;}
@media screen and ($bp-min: $bp-med) {
//ul.navprimary__horizontal li:not(.contact){margin-top:21px;}
//ul.navprimary__horizontal li{height: 32px;}
//ul.navprimary__horizontal li.contact input{border-radius: 2px;}
}
@media only screen and (max-width: 1326px) {
.contact{ display:none; }