-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
15,094 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { StorybookConfig } from '@storybook/core-common'; | ||
|
||
export const rootMain: StorybookConfig = { | ||
stories: [], | ||
addons: ['@storybook/addon-essentials'], | ||
// webpackFinal: async (config, { configType }) => { | ||
// // Make whatever fine-grained changes you need that should apply to all storybook configs | ||
|
||
// // Return the altered config | ||
// return config; | ||
// }, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"workbench.colorCustomizations": { | ||
"activityBar.activeBackground": "#660a74", | ||
"activityBar.background": "#660a74", | ||
"activityBar.foreground": "#e7e7e7", | ||
"activityBar.inactiveForeground": "#e7e7e799", | ||
"activityBarBadge.background": "#93810d", | ||
"activityBarBadge.foreground": "#e7e7e7", | ||
"commandCenter.border": "#e7e7e799", | ||
"sash.hoverBorder": "#660a74", | ||
"statusBar.background": "#3d0645", | ||
"statusBar.foreground": "#e7e7e7", | ||
"statusBarItem.hoverBackground": "#660a74", | ||
"statusBarItem.remoteBackground": "#3d0645", | ||
"statusBarItem.remoteForeground": "#e7e7e7", | ||
"titleBar.activeBackground": "#3d0645", | ||
"titleBar.activeForeground": "#e7e7e7", | ||
"titleBar.inactiveBackground": "#3d064599", | ||
"titleBar.inactiveForeground": "#e7e7e799" | ||
}, | ||
"peacock.color": "#3d0645" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { rootMain } from '../../../.storybook/main'; | ||
|
||
import type { StorybookConfig, Options } from '@storybook/core-common'; | ||
|
||
const config: StorybookConfig = { | ||
...rootMain, | ||
core: { ...rootMain.core, builder: '@storybook/builder-vite' }, | ||
stories: [ | ||
...rootMain.stories, | ||
'../src/app/**/*.stories.mdx', | ||
'../src/app/**/*.stories.@(js|jsx|ts|tsx)', | ||
], | ||
addons: [...(rootMain.addons || [])], | ||
}; | ||
|
||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './../src/styles.css'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"emitDecoratorMetadata": true | ||
}, | ||
|
||
"exclude": ["../**/*.spec.ts"], | ||
"include": [ | ||
"../src/**/*.stories.ts", | ||
"../src/**/*.stories.js", | ||
"../src/**/*.stories.jsx", | ||
"../src/**/*.stories.tsx", | ||
"../src/**/*.stories.mdx", | ||
"*.ts", | ||
"*.js" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
apps/master-wc-app/src/app/stories/card-layout/CardLayout.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import './CardLayout' | ||
|
||
export default { | ||
title: 'Components/CardLayout', | ||
// ? Create controls for the story | ||
argTypes: { | ||
image: { | ||
control: { type: 'text' }, // ? make storybook display text field in the Controls section | ||
}, | ||
headline: { | ||
control: { type: 'text' }, | ||
}, | ||
content: { | ||
control: { type: 'text' }, | ||
}, | ||
link: { | ||
control: { type: 'text' }, | ||
}, | ||
} | ||
} | ||
|
||
// const image = "http://unsplash.it/g/500/500?random&blur&gravity=center" | ||
const image = "https://images.unsplash.com/photo-1515879218367-8466d910aaa4?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=3569&q=80" | ||
|
||
/* const PrimaryTemplate = () => ` | ||
<wc-card-layout> | ||
<img slot="image" src="${image}" alt="Image" /> | ||
<h4 slot="header">Food</h4> | ||
<p slot="content">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p> | ||
<a href="#" slot="footer">Read</a> | ||
</wc-card-layout>`; */ | ||
|
||
|
||
|
||
const PrimaryTemplate = ({ images, headline, content, link }) => ` | ||
<wc-card-layout> | ||
<img slot="header" src="${image}"> | ||
<h4 slot="header">${headline}</h4> | ||
<p slot="content">${content}</p> | ||
<a href="#" slot="footer">${link}</a> | ||
</wc-card-layout>; | ||
` | ||
|
||
export const LayoutCard = PrimaryTemplate.bind({}); | ||
|
||
// ? Set default values for control | ||
LayoutCard.args = { | ||
images: image, | ||
headline: 'Food', | ||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.', | ||
link: 'Read' | ||
} |
21 changes: 21 additions & 0 deletions
21
apps/master-wc-app/src/app/stories/card-layout/CardLayout.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export class CardLayoutComponent extends HTMLElement { | ||
constructor() { | ||
super() | ||
const shadowRoot = this.attachShadow({ mode: 'open' }) | ||
const template = document.createElement('template') | ||
template.innerHTML = ` | ||
<header> | ||
<slot name="header"></slot> | ||
</header> | ||
<section> | ||
<slot name="content"></slot> | ||
</section> | ||
<footer> | ||
<slot name="footer"></slot> | ||
</footer> | ||
` | ||
shadowRoot.appendChild(template.content.cloneNode(true)) | ||
} | ||
} | ||
|
||
customElements.define('wc-card-layout', CardLayoutComponent) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { CardComponent } from './Card'; | ||
|
||
export default { | ||
title: 'Components/Card',// ? displayed in the Storybook sidebar | ||
} | ||
|
||
const PrimaryTemplate = () => `<wc-card></wc-card>`; | ||
export const ImageCard = PrimaryTemplate.bind({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//NOTE - Autonomous Custom Element | ||
|
||
export class CardComponent extends HTMLElement { | ||
constructor() { | ||
super(); // ? establish the proper prototype chain | ||
|
||
// ? instantiate the shadow DOM | ||
// ? attachShadow() open will returns a ShadowRoot object | ||
// ? allowing access to the shadow DOM via JavaScript | ||
const shadowRoot = this.attachShadow({ mode: 'open' }); | ||
|
||
// ? HTML template = Reuseable DOM tree that are not parsed until they are instantiated. | ||
const template = document.createElement('template'); | ||
template.innerHTML = ` | ||
<span>Hello world</span> | ||
` | ||
shadowRoot.appendChild(template.content.cloneNode(true)); | ||
} | ||
} | ||
|
||
// ? Register the custom element with the CustomElementRegistry | ||
customElements.define('wc-card', CardComponent); // ! kebab-case with at least one dash |
Oops, something went wrong.