Skip to content

Instantly share code, notes, and snippets.

@hannachen
hannachen / easdk-titlebar-update-button.js
Created August 27, 2019 06:45
EASDK `ShopifyApp.Bar.initialize` update button
ShopifyApp.Bar.initialize({
buttons: {
primary: {
label: "Confirm Save",
},
secondary: [
{
label: "Cancel"
}
]
@hannachen
hannachen / easdk-titlebar-initialize.js
Created August 27, 2019 06:39
EASDK `ShopifyApp.Bar.initialize`
ShopifyApp.Bar.initialize({
buttons: {
primary: {
label: "Save",
},
secondary: [
{
label: "Cancel"
}
]
@hannachen
hannachen / app-bridge-titlebar-create.js
Created August 26, 2019 15:37
App Bridge Title Bar: Create
import {TitleBar} from ‘@shopify/app-bridge/actions’;
// Create buttons
const saveButton = Button.create(app, { label: 'Save' });
const cancelButton = Button.create(app, { label: 'Cancel' });
// Setup title bar options
const titleBarOptions = {
title: 'My page title',
buttons: {
@hannachen
hannachen / app-bridge-create-titlebar.js
Created August 23, 2019 20:56
App Bridge Create Title Bar
import { TitleBar } from '@shopify/app-bridge/actions';
const titleBar = TitleBar.create(app, {
title: 'My page title',
});
@hannachen
hannachen / app-bridge-initialize-es5-cdn.html
Last active August 23, 2019 20:48
App Bridge Initialize - ES5/CDN
<script src="https://unpkg.com/@shopify/app-bridge"></script>
<script>
var AppBridge = window['app-bridge'];
var createApp = AppBridge.default;
var app = createApp({
apiKey: 'API key from Shopify Partner Dashboard',
shopOrigin: shopOrigin,
});
</script>
@hannachen
hannachen / app-bridge-initialize-react.jsx
Created August 23, 2019 20:45
App Bridge Initialize - React Component
import React from 'react';
import ReactDOM from 'react-dom';
import {Provider, TitleBar} from '@shopify/app-bridge-react';
function MyApp() {
const config = {apiKey: '12345', shopOrigin: shopOrigin};
return (
<Provider config={config}>
<TitleBar title="My page title"/>
@hannachen
hannachen / app-bridge-create-client.js
Created August 23, 2019 20:43
Create a Shopify App Bridge client
import createApp from ‘@shopify/app-bridge’
const app = createApp({
apiKey: ‘app_api_key’,
shopOrigin: ‘example.myshopify.com’,
forceRedirect: true,
});
@hannachen
hannachen / app-bridge-vs-easdk-modal.js
Last active August 20, 2019 21:53
App Bridge Modal vs EASDK Modal
import {Modal} from '@shopify/app-bridge/actions';
const modalOptions = {
title: 'My Modal',
message: 'Hello world!',
};
const closeModalCallback = function() {
console.log('Modal was closed!');
}
@hannachen
hannachen / app-bridge-initialize-es-modules.js
Last active August 23, 2019 20:45
App Bridge Initialize - ES Modules
import createApp from '@shopify/app-bridge'
const app = createApp({
apiKey: 'app_api_key',
shopOrigin: 'example.myshopify.com',
forceRedirect: true,
});
@hannachen
hannachen / keybase.md
Created April 3, 2017 03:53
This Gist is used to proof my identity on Keybase

Keybase proof

I hereby claim:

  • I am hannachen on github.
  • I am hanna (https://keybase.io/hanna) on keybase.
  • I have a public key ASBMgItyA2aSK-Hbvy92-ipoSxbf4Z6uYhYiJfnykndkhQo

To claim this, I am signing this object: