UNPKG

optimizely-oui

Version:

Optimizely's Component Library.

154 lines 5.72 kB
import React from "react"; import { storiesOf } from "@storybook/react"; import { action } from "@storybook/addon-actions"; import { withKnobs, text, boolean as _boolean, select } from "@storybook/addon-knobs"; import Icon from "react-oui-icons"; import Link from "./index.js"; import Button from "../Button"; var stories = storiesOf("Navigation|Link", module); stories.addDecorator(withKnobs).addDecorator(function (story) { return React.createElement("div", { id: "root-preview" }, story()); }); stories.add("Default", function () { return React.createElement("ul", null, React.createElement("li", null, React.createElement(Link, { href: text("href", "http://google.com"), isDisabled: _boolean("isDisabled", false), style: select("style", { "default": "default", dark: "dark", muted: "muted", "bad-news": "bad-news", reverse: "reverse" }, "default") }, text("children", "Link")))); }).add("New window", function () { return React.createElement("ul", null, React.createElement("li", null, React.createElement(Link, { href: text("href", "http://google.com"), newWindow: _boolean("newWindow", true), style: select("style", { "default": "default", dark: "dark", muted: "muted", "bad-news": "bad-news", reverse: "reverse" }, "default") }, text("children", "Link")))); }).add("All links", function () { return React.createElement("ul", null, React.createElement("li", null, React.createElement(Link, { href: "http://google.com", isDisabled: _boolean("isDisabled", false), onClick: action("click blocklist item home") }, text("default", "Link"))), React.createElement("li", null, React.createElement(Link, { href: "http://google.com", isDisabled: _boolean("isDisabled", false), style: "dark" }, text("dark", "Link Dark"))), React.createElement("li", null, React.createElement(Link, { href: "http://google.com", isDisabled: _boolean("isDisabled", false), style: "muted" }, text("muted", "Link Muted"))), React.createElement("li", null, React.createElement(Link, { href: "http://google.com", isDisabled: _boolean("isDisabled", false), style: "bad-news" }, text("bad-news", "Link Bad News"))), React.createElement("li", { className: "background--brand" }, React.createElement(Link, { href: "http://google.com", isDisabled: _boolean("isDisabled", false), style: "reverse" }, text("reverse", "Link Reverse"))), React.createElement("li", null, React.createElement(Link, { href: "http://google.com", isDisabled: _boolean("isDisabled", false), isFullWidth: _boolean("isFullWidth", true) }, text("full width", "Link with isFullWidth")))); }).add("All disabled", function () { return React.createElement("ul", null, React.createElement("li", null, React.createElement(Link, { href: "http://google.com", isDisabled: true }, "Link")), React.createElement("li", null, React.createElement(Link, { href: "http://google.com", isDisabled: true, style: "dark" }, "Link Dark")), React.createElement("li", null, React.createElement(Link, { href: "http://google.com", isDisabled: true, style: "muted" }, "Link Muted")), React.createElement("li", null, React.createElement(Link, { href: "http://google.com", isDisabled: true, style: "bad-news" }, "Link Bad News")), React.createElement("li", { className: "background--brand" }, React.createElement(Link, { href: "http://google.com", isDisabled: true, style: "reverse" }, "Link Reverse"))); }).add("Link that looks like a Button", function () { return React.createElement("div", null, React.createElement("p", null, React.createElement("span", { className: "push--right" }, React.createElement(Icon, { fill: "red", name: "exclamation" })), "Be sure to set the \xA0", React.createElement("code", { className: "underline" }, React.createElement("strong", null, "isLink")), "\xA0 prop to `true` on the inner button when using this implementation"), React.createElement(Link, { newWindow: true, href: text("href", "http://google.com") }, React.createElement(Button, { isLink: _boolean("isLink", true) }, "Go To Google")), React.createElement(Link, { newWindow: true, href: text("href", "http://google.com") }, React.createElement(Button, { style: "outline", isLink: true, leftIcon: "save", rightIcon: "external" }, "With an icon"))); }).add("Link with icon", function () { return React.createElement("ul", null, React.createElement("li", null, React.createElement(Link, { href: "http://google.com", style: select("style", { "default": "default", dark: "dark", muted: "muted", "bad-news": "bad-news", reverse: "reverse" }, "default"), leftIcon: "calendar", isDisabled: _boolean("isDisabled", false), onClick: action("click blocklist item home") }, text("default", "Link"))), React.createElement("li", null, React.createElement(Link, { href: "http://google.com", style: select("style", { "default": "default", dark: "dark", muted: "muted", "bad-news": "bad-news", reverse: "reverse" }, "default"), rightIcon: "external" }, "External link"))); }); // storiesOf('Link (Fake)', module) // .addDecorator(withKnobs) // .addDecorator(story => ( // <div id="root-preview"> // {story()} // </div> // )) // .add('Enabled', () => { // return ( // <Link>Faux Link</Link> // ); // }) // .add('Disabled', () => { // return ( // <Link // isDisabled={ true }> // Faux Link // </Link> // ); // });