Skip to content

Commit

Permalink
fix: ts config and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kunjolee28 committed May 10, 2023
1 parent ccddb18 commit 795effd
Show file tree
Hide file tree
Showing 12 changed files with 198 additions and 72 deletions.
10 changes: 6 additions & 4 deletions dist/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { jsx as _jsx } from "react/jsx-runtime";
const App = () => {
return (_jsx("div", { children: "App" }));
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var jsx_runtime_1 = require("react/jsx-runtime");
var App = function () {
return ((0, jsx_runtime_1.jsx)("div", { children: "App" }));
};
export default App;
exports.default = App;
26 changes: 21 additions & 5 deletions dist/components/MyLabel.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
import { jsx as _jsx } from "react/jsx-runtime";
import './MyLabel.css';
export const MyLabel = ({ allCaps = false, color = 'primary', label = 'No label ', size = 'normal', fontColor = '', backgroundColor = 'transparent' }) => {
return (_jsx("span", Object.assign({ className: `label ${size} text-${color}`, style: { color: fontColor, backgroundColor } }, { children: allCaps ? label.toUpperCase() : label })));
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
export default MyLabel;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MyLabel = void 0;
var jsx_runtime_1 = require("react/jsx-runtime");
require("./MyLabel.css");
var MyLabel = function (_a) {
var _b = _a.allCaps, allCaps = _b === void 0 ? false : _b, _c = _a.color, color = _c === void 0 ? 'primary' : _c, _d = _a.label, label = _d === void 0 ? 'No label ' : _d, _e = _a.size, size = _e === void 0 ? 'normal' : _e, _f = _a.fontColor, fontColor = _f === void 0 ? '' : _f, _g = _a.backgroundColor, backgroundColor = _g === void 0 ? 'transparent' : _g;
return ((0, jsx_runtime_1.jsx)("span", __assign({ className: "label ".concat(size, " text-").concat(color), style: { color: fontColor, backgroundColor: backgroundColor } }, { children: allCaps ? label.toUpperCase() : label })));
};
exports.MyLabel = MyLabel;
exports.default = exports.MyLabel;
15 changes: 11 additions & 4 deletions dist/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
export { Button } from './stories/Button';
export { Header } from './stories/Header';
export { MyLabel } from './components/MyLabel';
export { Page } from './stories/Page';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Page = exports.MyLabel = exports.Header = exports.Button = void 0;
var Button_1 = require("./stories/Button");
Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return Button_1.Button; } });
var Header_1 = require("./stories/Header");
Object.defineProperty(exports, "Header", { enumerable: true, get: function () { return Header_1.Header; } });
var MyLabel_1 = require("./components/MyLabel");
Object.defineProperty(exports, "MyLabel", { enumerable: true, get: function () { return MyLabel_1.MyLabel; } });
var Page_1 = require("./stories/Page");
Object.defineProperty(exports, "Page", { enumerable: true, get: function () { return Page_1.Page; } });
29 changes: 22 additions & 7 deletions dist/stories/Button.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
Expand All @@ -9,14 +21,17 @@ var __rest = (this && this.__rest) || function (s, e) {
}
return t;
};
import { jsx as _jsx } from "react/jsx-runtime";
import './button.css';
Object.defineProperty(exports, "__esModule", { value: true });
exports.Button = void 0;
var jsx_runtime_1 = require("react/jsx-runtime");
require("./button.css");
/**
* Primary UI component for user interaction
*/
export const Button = (_a) => {
var { primary = false, size = 'medium', backgroundColor, label } = _a, props = __rest(_a, ["primary", "size", "backgroundColor", "label"]);
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
return (_jsx("button", Object.assign({ type: "button", className: ['storybook-button', `storybook-button--${size}`, mode].join(' '), style: { backgroundColor } }, props, { children: label })));
var Button = function (_a) {
var _b = _a.primary, primary = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? 'medium' : _c, backgroundColor = _a.backgroundColor, label = _a.label, props = __rest(_a, ["primary", "size", "backgroundColor", "label"]);
var mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
return ((0, jsx_runtime_1.jsx)("button", __assign({ type: "button", className: ['storybook-button', "storybook-button--".concat(size), mode].join(' '), style: { backgroundColor: backgroundColor } }, props, { children: label })));
};
export default Button;
exports.Button = Button;
exports.default = exports.Button;
19 changes: 11 additions & 8 deletions dist/stories/Button.stories.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
import { Button } from './Button';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Small = exports.Large = exports.Secondary = exports.Primary = void 0;
var Button_1 = require("./Button");
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
const meta = {
var meta = {
title: 'Example/Button',
component: Button,
component: Button_1.Button,
tags: ['autodocs'],
argTypes: {
backgroundColor: { control: 'color' },
},
};
export default meta;
exports.default = meta;
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
export const Primary = {
exports.Primary = {
args: {
primary: true,
label: 'Button',
},
};
export const Secondary = {
exports.Secondary = {
args: {
label: 'Button',
},
};
export const Large = {
exports.Large = {
args: {
size: 'large',
label: 'Button',
},
};
export const Small = {
exports.Small = {
args: {
size: 'small',
label: 'Button',
Expand Down
28 changes: 23 additions & 5 deletions dist/stories/Header.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { Button } from './Button';
import './header.css';
export const Header = ({ user, onLogin, onLogout, onCreateAccount }) => (_jsx("header", { children: _jsxs("div", Object.assign({ className: "wrapper" }, { children: [_jsxs("div", { children: [_jsx("svg", Object.assign({ width: "32", height: "32", viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg" }, { children: _jsxs("g", Object.assign({ fill: "none", fillRule: "evenodd" }, { children: [_jsx("path", { d: "M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z", fill: "#FFF" }), _jsx("path", { d: "M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z", fill: "#555AB9" }), _jsx("path", { d: "M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z", fill: "#91BAF8" })] })) })), _jsx("h1", { children: "Acme" })] }), _jsx("div", { children: user ? (_jsxs(_Fragment, { children: [_jsxs("span", Object.assign({ className: "welcome" }, { children: ["Welcome, ", _jsx("b", { children: user.name }), "!"] })), _jsx(Button, { size: "small", onClick: onLogout, label: "Log out" })] })) : (_jsxs(_Fragment, { children: [_jsx(Button, { size: "small", onClick: onLogin, label: "Log in" }), _jsx(Button, { primary: true, size: "small", onClick: onCreateAccount, label: "Sign up" })] })) })] })) }));
export default Header;
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Header = void 0;
var jsx_runtime_1 = require("react/jsx-runtime");
var Button_1 = require("./Button");
require("./header.css");
var Header = function (_a) {
var user = _a.user, onLogin = _a.onLogin, onLogout = _a.onLogout, onCreateAccount = _a.onCreateAccount;
return ((0, jsx_runtime_1.jsx)("header", { children: (0, jsx_runtime_1.jsxs)("div", __assign({ className: "wrapper" }, { children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("svg", __assign({ width: "32", height: "32", viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg" }, { children: (0, jsx_runtime_1.jsxs)("g", __assign({ fill: "none", fillRule: "evenodd" }, { children: [(0, jsx_runtime_1.jsx)("path", { d: "M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z", fill: "#FFF" }), (0, jsx_runtime_1.jsx)("path", { d: "M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z", fill: "#555AB9" }), (0, jsx_runtime_1.jsx)("path", { d: "M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z", fill: "#91BAF8" })] })) })), (0, jsx_runtime_1.jsx)("h1", { children: "Acme" })] }), (0, jsx_runtime_1.jsx)("div", { children: user ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("span", __assign({ className: "welcome" }, { children: ["Welcome, ", (0, jsx_runtime_1.jsx)("b", { children: user.name }), "!"] })), (0, jsx_runtime_1.jsx)(Button_1.Button, { size: "small", onClick: onLogout, label: "Log out" })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { size: "small", onClick: onLogin, label: "Log in" }), (0, jsx_runtime_1.jsx)(Button_1.Button, { primary: true, size: "small", onClick: onCreateAccount, label: "Sign up" })] })) })] })) }));
};
exports.Header = Header;
exports.default = exports.Header;
15 changes: 9 additions & 6 deletions dist/stories/Header.stories.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
import { Header } from './Header';
const meta = {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LoggedOut = exports.LoggedIn = void 0;
var Header_1 = require("./Header");
var meta = {
title: 'Example/Header',
component: Header,
component: Header_1.Header,
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
tags: ['autodocs'],
parameters: {
// More on how to position stories at: https://storybook.js.org/docs/react/configure/story-layout
layout: 'fullscreen',
},
};
export default meta;
export const LoggedIn = {
exports.default = meta;
exports.LoggedIn = {
args: {
user: {
name: 'Jane Doe',
},
},
};
export const LoggedOut = {};
exports.LoggedOut = {};
31 changes: 23 additions & 8 deletions dist/stories/Page.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 795effd

Please sign in to comment.