Giter Club home page Giter Club logo

shopify / polaris Goto Github PK

View Code? Open in Web Editor NEW
5.6K 497.0 1.2K 264.64 MB

Shopify’s design system to help us work together to build a great experience for all of our merchants.

Home Page: https://polaris.shopify.com

License: Other

JavaScript 2.27% TypeScript 62.93% SCSS 3.04% CSS 4.86% Handlebars 0.03% HTML 11.74% MDX 15.14%
shopify-polaris react typescript design-system component-library design-systems design-tokens figma-plugin icons vscode-extension

polaris's Introduction

Polaris

Build. Contribute. Evolve. Shape the merchant experience for Shopify’s core product, the admin.

storybook npm version CI PRs Welcome

Status Owner Help
Active @shopify/polaris New issue

About this repo

The shopify/polaris repository is an intergalactic monorepo made up of NPM packages, VSCode extensions, and websites.

polaris/
├── documentation               # Documentation for working in the monorepo
├── polaris-for-vscode          # VS Code extension for Polaris
├── polaris-icons               # Icons for Polaris
├── polaris-react               # Components for @shopify/polaris package
├── polaris-tokens              # Design tokens for Polaris
├── polaris.shopify.com         # Documentation website
└── stylelint-polaris           # Rules for custom property usage and mainline coverage

Commands

Install dependencies and build workspaces

pnpm install && pnpm build

Run a command

One workspace

Run commands from a selected workspace using turbo run <command> --filter=<workspace>... flag.

Command Runs
pnpm turbo run dev --filter=@shopify/polaris Open the react component storybook
pnpm turbo run dev --filter=polaris.shopify.com Open polaris.shopify.com NextJS site

All workspaces

Run commands across all workspaces. This uses turbo run <command>.

Command Runs
pnpm changeset Adds a new changelog entry
pnpm lint Lints all workspaces
pnpm test Tests all workspaces
pnpm type-check Build types and check for type errors
pnpm clean Remove generated files
pnpm format Format files with prettier

Contribute to this repo

Pull requests are welcome. See the contribution guidelines for more information.

Licenses

Source code is under a custom license based on MIT. The license restricts Polaris usage to applications that integrate or interoperate with Shopify software or services, with additional restrictions for external, stand-alone applications.

All icons and images are licensed under the Polaris Design Guidelines License Agreement

polaris's People

Contributors

aaronccasanova avatar alex-page avatar andrewmusgrave avatar aveline avatar bpscott avatar chloerice avatar danrosenthal avatar dependabot[bot] avatar dfmcphee avatar dleroux avatar gwyneplaine avatar harbify avatar ismail-syed avatar jesstelford avatar kaelig avatar kyledurand avatar laurkim avatar lemonmade avatar lgriffee avatar lwise avatar martenbjork avatar michenly avatar mrcthms avatar ry5n avatar sam-b-rose avatar shopify-github-actions-access[bot] avatar sophschneider avatar tmlayton avatar translation-platform avatar yurm04 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

polaris's Issues

Sketch grid and layout guidance

Issue summary

The Sketch file is a thing of beauty. Thank you for the hard work and inspiration.

Would love to see some more consistency in the spacings.
screen shot 2017-04-21 at 3 21 45 pm
☝️ is just one example but found a handful of others.

Would also love to see some guidance as to the grids and guides used. At times spacing was a factor of 10px other times they were factors of 8px.

  • Polaris version: v1.0.0
  • Sketch version: 43.2
  • Device: Mac
  • Operating System: macOS Sierra

License type & file missing

Issue summary

  • License file missing from the root of the project.
  • License type missing from the package.json file.

Expected behavior

LICENSE.md

When there is a LICENSE.md file on the root of the repository, GitHub will show the type of license for users and search engines. It will also help 3rd party tools like to figure out the type of license via The Licenses API of GitHub.

GitHub repository's license is displayed on the top right corner of the info bar:
screenshot from 2017-04-23 14-46-59 github repository license is displayed on the top right corner of the info bar

More details from GitHub's User Documentation: Licensing a repository

package.json

It would also make sense to add right license type to the package.json file. This is important, because it will allow tools to automatically validate whether license is compatible with requirements or not.

  "license": "MIT",

More detailed description about "license": structure (and accepted license types).

Actual behavior

License file is not found from the Git repository, so the UI of GitHub is not displaying it for the potential users.
screenshot from 2017-04-23 14-50-14 github license file missing

Missing license from the package.json file makes it difficult to automatically verify the license type:

  "license": "SEE LICENSE IN README.md",

Steps to Reproduce the Problem

  1. Open the GitHub repository on the address: https://github.com/Shopify/polaris
  2. Look at the information displayed on the top right corner of the info bar.
  3. Look at the package.json file, and see what "license": type is there.

Specifications

  • Polaris version: v1.0.1
  • React version:
  • Browser:
  • Device:
  • Operating System:

Chart Type is blank

Issue summary

Chart Type is blank.

Expected behavior

There is content about it.

Actual behavior

Chart Type is listed on sidenav of polaris.shopify.com/visuals/data-visualizations but there's content.

Steps to Reproduce the Problem

  1. Go to polaris.shopify.com/visuals/data-visualizations
  2. Select Chart Type on the sidenav
  3. Nothing happens

Specifications

  • Polaris version:
  • React version:
  • Browser: Chrome
  • Device: Macbook
  • Operating System: OSX

NOTE: This repo is only used for reporting issues and new feature requests. We are not accepting pull requests at this point in time.

z-index not working properly

Issue summary

Some components like Badges, or the ResourceList in focused state overlap other elements. Tried to add z-index to the components, but not working at all.

bildschirmfoto 2017-04-27 um 19 37 42

  • Polaris version: 1.0.2
  • React version: 15.5.4
  • Browser: Chrome
  • Device: Macbook Pro 2015 Retina
  • Operating System: macOS Sierra 10.12.4

Selected Tab CSS Class

Issue summary

Tabs.scss contains a misspelled CSS class for the selected tab rules.

Expected behavior

CSS rules on line 79 and 86 should use Polaris-Tabs__Tab--selected to apply the active state border to the active item.

Actual behavior

CSS rules on line 79 and 86 are using Polaris-Tabs__Tab-selected which uses a single hyphen instead of a double when extending the class.

Steps to Reproduce the Problem

Try to set the active tab when using the tab component inside of any view.

Can't type in TextField component

Issue summary

The <input type="text" /> element the TextField component renders are unable to be typed in.

Expected behavior

The <input type="text" /> element the TextField component renders should be able to be typed in.

Actual behavior

All keypresses get ignored.

Steps to Reproduce the Problem

  1. Go here
  2. Scroll to the demo section and try and type in the text box
  3. Nothing happens

Specifications

  • Polaris version: 1.0.2
  • React version: 15.5.4
  • Browser: Chrome
  • Device: Macbook Pro
  • Operating System: macOS Sierra

DisplaySmall locked in UI kit

Issue summary

'DisplaySmall' is the only locked layer on the 'Titles and text' artboard on the 'Components' page of the UI Kit.

Expected behavior

Should be unlocked like the rest of the typescale.

Actual behavior

N/A

Steps to Reproduce the Problem

  1. Open UI Kit sketch file
  2. Click components page
  3. Navigate to Titles and text artboard for mobile and desktop
  4. Try select 'DisplaySmall' - it's locked.

Specifications

  • Polaris version: 1.0.0

NOTE: This repo is only used for reporting issues and new feature requests. We are not accepting pull requests at this point in time.

Color Picker example broken, throwing JS errors

Issue summary

The color picker example is broken. The page loads but on interaction with the components, JS errors occur and the component does not work.

https://polaris.shopify.com/components/forms/color-picker#navigation

Expected behavior

The color picker component should allow you to alter the options for color hue and transparency

Actual behavior

The color does not change in the picker and in the JS console, the following error occurs.

ColorPicker.tsx:106 Uncaught TypeError: (0 , o.onChange) is not a function at t.value (https://polaris.shopify.com/assets/demo-552e714115176d1f07c8.js:1:232008) at t.value (https://polaris.shopify.com/assets/demo-552e714115176d1f07c8.js:1:87981) at t.value (https://polaris.shopify.com/assets/demo-552e714115176d1f07c8.js:1:87466) at Object.r (https://polaris.shopify.com/assets/demo-552e714115176d1f07c8.js:1:44298) at a (https://polaris.shopify.com/assets/demo-552e714115176d1f07c8.js:1:40418) at Object.s [as executeDispatchesInOrder] (https://polaris.shopify.com/assets/demo-552e714115176d1f07c8.js:1:40633) at d (https://polaris.shopify.com/assets/demo-552e714115176d1f07c8.js:1:22704) at m (https://polaris.shopify.com/assets/demo-552e714115176d1f07c8.js:1:22830) at Array.forEach (native) at r (https://polaris.shopify.com/assets/demo-552e714115176d1f07c8.js:1:69554)

Steps to Reproduce the Problem

  1. Visit the Color picker example page
  2. Click on any of the elements (square gradient, vertical color bar, vertical transparency bar)
  3. No visible UI changes
  4. Errors are shown in the developer tools console

Specifications

  • Polaris version: N/A
  • React version: N/A
  • Browser: Chrome 57
  • Device: Macbook Pro
  • Operating System: OSX 10.12.3

NOTE: This repo is only used for reporting issues and new feature requests. We are not accepting pull requests at this point in time.

Example webpack when yarn start - Module build failed: Error: Couldn't find preset "shopify/node" relative to directory ...

Issue summary

When I´m testing the example "polaris/examples/webpack/" show me the error: "Module build failed: Error: Couldn't find preset "shopify/node" relative to directory"

Actual behavior

Inside polaris/examples/webpack, after yarn install and yarn start show me an error: "Module build failed: Error: Couldn't find preset "shopify/node" relative to directory ..."

Steps to Reproduce the Problem

  1. Inside polaris/examples/webpack;
  2. yarn install;
  3. yarn start.

Specifications

  • Polaris version: 1.0.0
  • React version: 15.4.2
  • Browser: Chrome
  • Device: PC
  • Operating System: Windows 10

Description List example: "There is an error in your code"

Issue summary

Steps to Reproduce the Problem

  1. Go to https://polaris.shopify.com/components/tables-and-lists/description-list
  2. In the example section, click "HTML"

Expected behavior

<dl class="Polaris-DescriptionList"><dt class="Polaris-DescriptionList__Term">Logistics</dt>
  <dd class="Polaris-DescriptionList__Description">The management of products or other resources as they travel between a point of origin and a destination.</dd><dt class="Polaris-DescriptionList__Term">Sole proprietorship</dt>
  <dd class="Polaris-DescriptionList__Description">A business structure where a single individual both owns and runs the company.</dd><dt class="Polaris-DescriptionList__Term">Discount code</dt>
  <dd class="Polaris-DescriptionList__Description">A series of numbers and/or letters that an online shopper may enter at checkout to get a discount or special offer.</dd>
</dl>

Note that navigating away to another component, and then back to the Description List component shows this expected code.

Actual behavior

<pre class="error">There is an error in your code.</pre>

screenshot 2017-05-07 01 00 20

Specifications

  • Polaris version: latest documentation
  • Browser: Chrome
  • Operating System: macOS

Select component, option text is always set to the option value

Issue summary

The select component always sets the option value to the option text. There is no way to define options with text and values that differ.

Expected behavior

The select component should have a way to set options that differ in value and display text. Possibly accepting a JSON structure would work.

options={[
	{"text": "red", "value": "1"},
	{"text": "white", "value": "2"},
	{"text": "blue", "value": "3"}]}
<select id="tester" name="tester" class="Polaris-Select__Input" aria-invalid="false">
	<option value="1">red</option>
	<option value="2">white</option>
	<option value="3">blue</option>
</select>

Actual behavior

The select component only accepts an array of option values

options={['red', 'white', 'blue']}

The select component always sets the option text to the option value

<select id="tester" name="tester" class="Polaris-Select__Input" aria-invalid="false">
	<option value="red">red</option>
	<option value="white">white</option>
	<option value="blue">blue</option>
</select>

Steps to Reproduce the Problem

<Select value=""
	name="tester"
	options={['red', 'white', 'blue']}
/>

Specifications

  • Polaris version: v1.0.2
  • React version: 15.5.4
  • Browser: Chrome 57
  • Device: MacBook Pro
  • Operating System: 10.12.4

Documentation around visuals(colors, typography, etc) for offline browsing

I have one question, but before that let me thank the team behind this awesome project, it is really a piece of art and should get more stars here in Github.

For my question I wonder if there is a place where I can clone the documentation around visuals(colors, typography, etc) for offline browsing something like a gh-pages or similar.

Thanks for your time.

CSS only embedded app SDK usage

Issue summary

It is unclear whether embedded apps will continue to use the SDKs ShopifyApp.Bar from the javascript API (and it's breadcrumbs and primary/secondary buttons), or whether the app bar will disappear in the new version in favor of the new Polaris page header navigation style (without the app bar).

Will the app bar be disappearing with the release of Polaris? Or will javascript instantiated components (breadcrumbs, titles, etc.) be rendered with Polaris style when using the javascript API going forward?

Expected behavior

The javascript initialized app bar gets styled to match Polaris page header styling.

Actual behavior

It is unclear whether a CSS only embedded app should use the ShopifyApp.Bar or should use html/CSS for the Polaris Page Header Elements and not use the ShopifyApp.Bar.

Steps to Reproduce the Problem

  1. Have a CSS only embedded app
  2. Use the Shopify embedded app SDK
  3. Wonder what page header navigation system you are supposed to use.

NOTE: This repo is only used for reporting issues and new feature requests. We are not accepting pull requests at this point in time.

Documentation Suggestion: Color Usage

Issue summary

It is not entirely clear the colored circles in the Color Usage section of the docs are clickable.

Expected behavior

Perhaps the circles should change color or a more obvious "link" is used.

Customize Colors

Issue summary

While the Shopify Polaris color theme is great, how do we go about creating a customized color theme without losing the ability to merge in updates into our codebase and / sketch file?
A bigger question is, does Polaris encourage changing the color theme based on branding, or are we, as developers/designers on our own if we do choose to change colors to match?

Expected behavior

The Sketch Web.UIKit.sketch file should have used shared styles to make colors customizable so that app developers can customize the colors to fit branding while keeping the structure in place. This is possible in the CSS, however it is not in the Sketch file.

Actual behavior

Sketch Web.UIKit.sketch hard codes colors into every symbol, thus it is hard to start using if we wanted customized branding.

Specifications

N/A

SFUI fonts necessary to Sketch UI kit not included

Issue summary

After downloading the UI kit, when opening it I'm presented with a missing fonts dialog but am not given the fonts necessary to reconcile the issue.

Expected behavior

I should be presented ahead of time with font requirements and download locations.

Actual behavior

I'm presented with an error dialog, and the natural next step is to go looking for the fonts, not dismiss it and open the file anyway, which is the only way to see the link to get the necessary fonts.

Graphik Regular font mistakenly included in Sketch UI kit

Issue summary

Sketch UI kit sometimes uses Graphik Regular font rather than SFUI, causing missing font error for those without the font installed.

Expected behavior

SFUI font installation should resolve all missing font issues.

Actual behavior

Graphik regular used inconsistently in some places where SFUI appears to be preferred.

Steps to Reproduce the Problem

  1. Disable Graphik Regular font if installed.
  2. Open Sketch UI kit

To correct

  1. Install Font Finder sketch plugin
  2. Run plugin on "Examples - Core" page of Sketch file
  3. Replace incorrect font

<EmbeddedApp> forceRedirect option is not redirecting

Expected behavior

EmbeddedApp component with forceRedirect: true should redirect the app to the relative admin path when not rendered in an iframe

Actual behavior

I've inspected the code and it seems that it only sends the message but never actually redirects.
https://github.com/Shopify/polaris/blob/master/src/embedded/easdk/EASDK.ts#L58

I initialize the component like this

<EmbeddedApp
   shopOrigin={shopOrigin}
   apiKey={apiKey}
   forceRedirect>
   {children}
</EmbeddedApp>

Color picker max values for Brightness and Saturation.

Issue summary

ColorPicker README shows wrong maximum values for saturation and brightness.
https://github.com/Shopify/polaris/tree/master/src/components/ColorPicker

Expected behavior

The maximum values for saturation and brightness should be shown 1 as in practice the callback function receives a value between 0 and 1 for these values.

Actual behavior

They are being shown as 255 for a maximum value.
screen shot 2017-04-21 at 8 47 18 pm

Specifications

  • Polaris version: N/A
  • React version: N/A
  • Browser: N/A
  • Device: N/A
  • Operating System: N/A

Web.UIKit.sketch Typestyle 02 Subheading weight is wrong

Issue summary

On the Web.UIKit.sketch the typestyle 02 Subheading is using semibold but the weight reads bold.

Specifications

  • Polaris version: v1.0.2

NOTE: This repo is only used for reporting issues and new feature requests. We are not accepting pull requests at this point in time.

TypeError: this.props.onClose is not a function - Popover PopoverOverlay

Issue summary

An error is thrown if you do not define the onClose prop for the Popover component.

Expected behavior

No error should be thrown, or the documentation should include a "required" properties column.
None of the examples used the onClose prop, that's why it was an unexpected error. In actual usage I imagine most people will be defining onClose.

Actual behavior

The error happens when clicking on the invisible PopoverOverlay element.

TypeError: this.props.onClose is not a function
at Popover.handleClose
at PopoverOverlay.handleClick

The problem is here:
https://github.com/Shopify/polaris/blob/master/src/components/Popover/Popover.tsx#L101

handleClose gets called when PopoverOverlay closes and it's always assuming this.props.onClose is defined.

Steps to Reproduce the Problem

  1. A Popover must be open
  2. Click anywhere outside of the Popover (this click is registered on the PopoverOverlay element)
  3. Error is thrown (unless you defined the onClose prop)

Specifications

  • Polaris version: 1.0.2
  • React version: 15.5.0

Possible typo in the Color Combinations section

Issue summary

See below. I would’ve submitted a PR, but 1) you’re not accepting those yet and 2) I couldn’t find the source of the text to edit.

Expected behavior

In the ‘Do’ column, based on the code sample below it, it seems like it should say:

Use any light background color with its corresponding dark color for an action

Actual behavior

It currently says:

Use any light background color with its corresponding primary color for an action

Steps to Reproduce the Problem

  1. https://polaris.shopify.com/visuals/colors#color-combinations
  2. Scroll down a bit

Broken link on Embedded App page

Issue summary

The link within the smaller text blurb:

This component only works within embedded apps. Read the EASDK getting started guide for more details on how to use the EASDK with Polaris.

refers to the wrong location.

Expected behavior

The link should probably refer to the same link as the larger text above https://help.shopify.com/api/sdks/shopify-apps/embedded-app-sdk/getting-started

Actual behavior

Navigates you to https://github.com/Shopify/polaris/blob/master/documentation/Embedded%20apps.md

Steps to Reproduce the Problem

  1. Click the link
  2. Get to a 404 page on github

Specifications

  • Polaris version: N/A
  • React version: N/A
  • Browser: All
  • Device: All
  • Operating System: All

NOTE: This repo is only used for reporting issues and new feature requests. We are not accepting pull requests at this point in time.

Documentation on Componants > Navigation > Link doesn't load.

Issue summary

When navigating to the page https://polaris.shopify.com/components/navigation/link (either through the link on the pagination page or by going directly to it) the page content doesn't load.

Expected behavior

It should load the documentation.

Actual behavior

It doesn't load the documentation, it remains stuck in the loading state.

Steps to Reproduce the Problem

  1. Navigate to the page https://polaris.shopify.com/components/navigation/link

Specifications

  • Polaris version: 1.0.2
  • React version: I don't know. 15 something something
  • Browser: Chrome 57.0.2987.133 (64-bit)
  • Device: Macbook Pro
  • Operating System: MacOS

Why use px instead of em?

–Not an issue, just a question.–

On typography, why using px instead of using em?

It's obvious that as a designer we have more control of everything using px, but using em or rem we put the user first, assuming his preferences and limitations.

A person with visibility limitations can set his default font size as Big on browser settings, but he won't see any difference in a site using px.

I am not saying that px is bad, ugly and smell, just trying to understand the choice.

Documentation example input field is not working as expected

Issue summary

Example input field does not preserve input value

Expected behavior

If I type in "Dog", it should say Dog, not g (since only last input is preserved.)

Actual behavior

I type in "Dog", and only g is displayed.

Steps to Reproduce the Problem

  1. Go to: https://polaris.shopify.com/components/titles-and-text/display-text#examples (Or any exmple with an input field)
  2. Type in "Dog"
  3. Observe only g is displayed.

Specifications

  • Polaris version: 1.0.1

Typescript: Cannot find module '@shopify/images'.

Issue summary

@shopify/images is not found when using Typescript

Actual behavior

[steven:~/Projects/sizing_app/assets] 127 % yarn run tsc yarn run v0.23.4 $ "/Users/steven/Projects/sizing_app/assets/node_modules/.bin/tsc" node_modules/@shopify/polaris/types/components/Icon/Icon.d.ts(2,27): error TS2307: Cannot find module '@shopify/images'. error Command failed with exit code 2.

Specifications

  • Polaris version: 1.0.2
  • React version: 15.4.2

Add spinner for button component

Hi !

We often need (especially in modal that lead to a deletion or for long running tasks) to have a button with a spinner. This is currently the case for instance in the admin when importing large number of products.

Of course there is the app bar feature, but it's often a better experience, especially on delete, to simply show a spinner on the button when clicking on it instead of immediately closing the modal, as some unexpected error could happen during the deletion.

In the button component, adding a "loading" or "spinning" property would be an awesome addition ;).

If you need further details about use cases, do not hesitate to ask me :).

CSS Class Issue.

Issue summary

The Polaris-ResourceList__Item--persistActions class suggested in the docs for the ResourceList component does not match the CSS class in the styles.scss file that's generated.

Expected behavior

CSS should use Polaris-ResourceList__Item--persistActions

Actual behavior

CSS is using Polaris-ResourceList__Item-persistActions.

Steps to Reproduce the Problem

Try to implement a ResourceList item with actions and it will not show the actions since the CSS to unhide the element never gets applied.

Specifications

  • Polaris version: 1.0.0

Display Metrics is listed twice

Issue summary

Display Metrics is listed twice.

Expected behavior

One should be removed.

Actual behavior

Display Metrics is listed twice on the sidenav and in the content on polaris.shopify.com/visuals/data-visualizations

Steps to Reproduce the Problem

  1. Go to polaris.shopify.com/visuals/data-visualizations
  2. Look at the nav

Specifications

  • Polaris version:
  • React version:
  • Browser: Chrome
  • Device: Macbook
  • Operating System: OSX

NOTE: This repo is only used for reporting issues and new feature requests. We are not accepting pull requests at this point in time.

VueJs support

Hi Shopify team,
Do you know if there will be a VueJs support in the future?

Embedded app not loading inside Shopify admin using <EmbeddedApp> component

Issue summary

Previously I've been initializing my embedded app using

ShopifyApp.init({
  apiKey: 'YOUR_APP_API_KEY',
  shopOrigin: 'https://CURRENT_LOGGED_IN_SHOP.myshopify.com'
});

as described on https://help.shopify.com/api/sdks/shopify-apps/embedded-app-sdk/initialization

If the page is opened outside of the Shopify admin then this causes the Shopify admin to load showing my page inside it.

From the documentation I believe that when I'm using Polaris I don't need to call ShopifyApp.init() as <EmbeddedApp></EmbeddedApp> is supposed to handle this for me. For example:

<EmbeddedApp shopOrigin={shopOrigin} apiKey={apiKey} >
    <ResourcePicker
      open
      products
      onSelection={(resources) => console.log('Selected resources ', resources)}
    />
</EmbeddedApp>

This appears to be attempting to initialize Shopify by posting a message:

"Posting message: {"message":"Shopify.API.initialize","data":{"apiKey":"xxxxxxxxxxxxx","shopOrigin":"https://growing-ecommerce.myshopify.com","metadata":{"@shopify/polaris":"1.0.2"}}} to https://growing-ecommerce.myshopify.com }"

That fails if the page isn't already loaded inside the Shopify Admin with

Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘https://growing-ecommerce.myshopify.com’) does not match the recipient window’s origin (‘https://localhost:5000’).

Expected behavior

If I open a page with <EmbeddedApp></EmbeddedApp> on it outside of the Shopify Admin then I expect it to load the Shopify Admin with my page inside it.

This is needed to get back into the Shopify Admin after logging in. For example:

  1. User goes to the login page https://my-app/login?shop=example.myshopify.com
  2. User is redirected to Shopify OAuth page via a full page redirect so they are no longer inside the Shopify Admin (see https://help.shopify.com/api/sdks/shopify-apps/embedded-app-sdk/getting-started)
  3. After successful authentication they are redirected back to our app (still outside of the Shopify admin) where they are logged in and redirected to the apps home page
  4. The user now sees the app's home page which contains <EmbeddedApp></EmbeddedApp> but they remain outside of the Shopify admin because the initialize isn't working. (See "Steps to Reproduce the Problem" for how I'm currently working around this)

Actual behavior

My page loads without loading the Shopify Admin

Steps to Reproduce the Problem

  1. Create a page with <EmbeddedApp shopOrigin={shopOrigin} apiKey={apiKey} ></EmbeddedApp> on it.
  2. Visit that page outside of the Shopify Admin.
  3. Instead of redirecting you so the page appears as an embedded app inside the Shopify Admin you should see your page outside of the Shopify Admin.
  4. Add ShopifyApp.init({apiKey: apiKey, shopOrigin: shopOrigin }); so that it's called before the <EmbeddedApp></EmbeddedApp>
  5. Visit the page outside of the Shopify Admin.
  6. It should now redirect so the page is loaded as an embedded app inside the Shopify Admin. <-- I'm using this approach to get around it.

Specifications

  • Polaris version: 1.0.2
  • React version: 15.5.4
  • Browser: Firefox 53.0
  • Device: Mac
  • Operating System: 10.12.4

NOTE: This repo is only used for reporting issues and new feature requests. We are not accepting pull requests at this point in time.

Missing @shopify/polaris dependency when developing in TypeScript.

Issue summary

Missing NPM dependency when developing in TypeScript.

Expected behavior

After installing Polaris using

npm install @shopify/polaris --save

I expect to be able to compile applications using the TypeScript compiler.

Actual behavior

When running tsc the following error is produced:

node_modules/@shopify/polaris/types/components/Icon/Icon.d.ts(2,27): error TS2307: Cannot find module '@shopify/images'.

Steps to Reproduce the Problem

  1. Create a new React app using TypeScript. Verify that it compiles ok
  2. Install Polaris using npm install @shopify/polaris --save
  3. Add some code that uses Polaris (I have a sample at https://github.com/buggy/polaris-demo)
  4. Attempt to compile the application using tsc. You'll now see the error.

This can be fixed by running npm install @shopify/images --save to add the missing dependency.

Specifications

  • Polaris version: 1.0.1
  • React version: 15.5.4
  • Browser: Firefox 53.0
  • Device: Mac
  • Operating System: 10.12.4

NOTE: This repo is only used for reporting issues and new feature requests. We are not accepting pull requests at this point in time.

The No symbol used in error states is incorrect

Issue summary

The symbol should be rotated 90°.

Expected behavior

The No symbol or prohibition sign has a diagonal line running from top left to bottom right.
iso 3864-1 prohibition sign
https://en.wikipedia.org/wiki/No_symbol

Actual behavior

The symbols in Web.UIKit.sketch Components page on the 🖥 Feedback indicators - Banners
and 📱 Feedback indicators - Banners artboards have diagonal lines running from top right to bottom left.
polaris no symbol

TypeScript Cannot find module @shopify/polaris/embedded

Issue summary

The TypeScript compiler is unable to find the type definition for @shopify/polaris/embedded at the following line:

import {EmbeddedApp} from "@shopify/polaris/embedded";

Expected behavior

I expect it to be able to find the type definition for @shopify/polaris/embedded and import the EmbeddedApp component .

Actual behavior

When running tsc I receive the following error:

src/containers/HomeContainer.tsx(3,27): error TS2307: Cannot find module '@shopify/polaris/embedded'.

Steps to Reproduce the Problem

I took the embedded app example from https://github.com/Shopify/polaris/blob/master/documentation/Embeddded%20apps.md and modified it to work with TypeScript. The new code is:

import * as React from "react";
import {Page, Card} from "@shopify/polaris";
import {EmbeddedApp} from "@shopify/polaris/embedded";

export default class MyApp extends React.Component<undefined, undefined> {
  render() {
    return (
      <EmbeddedApp
        apiKey="YOUR_APP_API_KEY"
        shopOrigin="https://CURRENT_LOGGED_IN_SHOP.myshopify.com"
      >
        <Page title="Example application">
          <Card sectioned>
            Insert the rest of your app here, including those components detailed below, which can now communicate with the Embedded App SDK.
          </Card>
        </Page>
      </EmbeddedApp>
    );
  }
}

The TypeScript compiler reports that it cannot find @shopify/polaris/embedded/

If I append export * from './embedded'; at the bottom of polaris/types/index.d.ts then import {EmbeddedApp} from "@shopify/polaris"; it finds the type definition so the file clearly exists and is valid. I'm not sure why TypeScript can't find it.

Specifications

  • Polaris version: 1.0.1
  • React version: 15.5.4
  • Browser: Firefox 53.0
  • Device: Mac
  • Operating System: 10.12.4
  • TypeScript 2.2.2

NOTE: This repo is only used for reporting issues and new feature requests. We are not accepting pull requests at this point in time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.