Coder Social home page Coder Social logo

nodexpertsdev / polaris Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shopify/polaris

0.0 2.0 0.0 1.75 MB

Shopify’s product component library

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

License: MIT License

JavaScript 4.97% TypeScript 77.10% HTML 0.04% Ruby 0.10% CSS 17.79%

polaris's Introduction

Polaris

CircleCI

Polaris is a React component library designed to help developers create the best experience for merchants who use Shopify. Visit the Polaris style guide to learn more.

Using the React components

We strongly recommend using the React versions of our components. It’s the version that we’ll be using internally. It allows for rich, complex components like Tabs and Popovers, and will not have as many breaking changes as the CSS-only version.

Installation:

Run the following command using npm:

npm install @shopify/polaris --save

If you prefer Yarn, use the following command instead:

yarn add @shopify/polaris

Usage

  1. Include the CSS in your HTML:
 <link rel="stylesheet" href="https://sdks.shopifycdn.com/polaris/2.0.0/polaris.min.css" />

Note: you can import the CSS directly into your project if your asset packager supports it:

import "@shopify/polaris/styles.css";
  1. Include any of the provided components in your project:
import { AppProvider, Page, Card, Button } from "@shopify/polaris";
  1. Tell React to render the element in the DOM:
ReactDOM.render(
  <AppProvider>
    <Page title="Example app">
      <Card sectioned>
        <Button onClick={() => alert("Button clicked!")}>Example button</Button>
      </Card>
    </Page>
  </AppProvider>,
  document.querySelector("#app")
);

Using the Embedded App SDK

We provide React wrappers around Shopify’s Embedded App SDK (EASDK). You don’t need to go through the initialization of the EASDK as described in the docs. Instead, configure the connection to the Admin through the AppProvider component.

Using the CSS components

If React doesn’t make sense for your application, you can use a CSS-only version of our components. This includes all the styles you need for every component in the library, but you’ll be responsible for writing the correct markup and updating classes and DOM attributes in response to user events.

Usage

  1. Include the CSS in your HTML:
<link rel="stylesheet" href="https://sdks.shopifycdn.com/polaris/2.0.0/polaris.min.css" />
  1. Include the markup and associated classes in your HTML document:
<button class="Polaris-Button">Example button</button>

Examples

We have created example applications to document some of the ways you could include Polaris in one of your own applications. Each of these examples includes further documentation on how to install dependencies and run the app:

We’ve also created a simple, hot-reloading playground for these components. You can edit the playground/Playground.tsx file to import the components you want to play with, and run yarn dev in order to start the development server.

Learning resources

If you’re new to React, we recommend you start with the official React Getting Started documentation. As you read through the topics we suggest you follow along using their React Hello World CodePen example.

Additional resources:

Methodology

We set out to make our components easy to use. Each of our components has a well-documented (and fully typed) public interface with strong, consistently-applied conventions. This way, developers don’t need to worry about the underlying implementation. Instead, they can focus on creating amazing merchant experiences.

We ensure that our components are made for everyone. They meet accessibility standards and are responsive to any screen or device. We also put a lot of effort into optimizing the performance of the components, so everyone can build inclusive experiences that work.

We make our components flexible enough to meet diverse needs. They present the information you pass in and give you smart callbacks when something has changed, but they don’t enforce any structure beyond that. No matter what type of experience you’re creating, you can use components as the building blocks of your product or feature.

Licenses

Feedback

Create an issue or feature request.

At this point in time we’re not accepting pull requests. This is something we’ll support in the future. Stay tuned.

polaris's People

Contributors

shopify-polaris-bot avatar lemonmade avatar ismail-syed avatar kaelig avatar

Watchers

James Cloos avatar NodeXperts avatar

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.