-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* move narrow template theme styles * add build assets rush command * wip * add place holder * add reverse template and JS note * fix seal url in template * add doc * remove toolbar in story * fix links * add link to template doc from usage doc * add code template * Update packages/core/stories/styles/index.scss * Update packages/core/stories/styles/index.scss
- Loading branch information
1 parent
946ef7f
commit 59537ef
Showing
9 changed files
with
199 additions
and
3 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
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 @@ | ||
.ma__placeholder { | ||
color:#bbb; | ||
min-height:200px; | ||
border:4px dashed #ddd; | ||
font-size:2rem; | ||
line-height:200px; | ||
text-align:center; | ||
} |
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
100 changes: 100 additions & 0 deletions
100
packages/core/stories/components/Template/Template.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,100 @@ | ||
import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks'; | ||
|
||
import generateTitle from '../../util/generateTitle'; | ||
import * as headerStories from '../Header/Header.stories.js'; | ||
import * as footerStories from '../Footer/Footer.stories.js'; | ||
|
||
const { STORYBOOK_CDN_PATH } = process.env; | ||
|
||
import { attachHTML } from '../../util/renderCode'; | ||
|
||
export const template = ({renderHeader, renderFooter, reversed}) => { | ||
return( | ||
<div id="body-wrapper"> | ||
{renderHeader} | ||
<main id="main-content"> | ||
<div className="pre-content sp--bottom"> | ||
<div className="ma__placeholder"> | ||
Pre Content | ||
</div> | ||
</div> | ||
<div className="main-content ma__container"> | ||
<div className="ma__placeholder"> | ||
Main Content | ||
</div> | ||
</div> | ||
<div className={`main-content main-content--two ${reversed ? 'main-content--reversed' : ''}`}> | ||
{ reversed && ( | ||
<aside className="sidebar"> | ||
<div className="ma__placeholder"> | ||
Left Rail | ||
</div> | ||
</aside> | ||
) | ||
} | ||
<div className="page-content"> | ||
<div className="ma__placeholder"> | ||
Main Content | ||
</div> | ||
</div> | ||
{ !reversed && ( | ||
<aside className="sidebar"> | ||
<div className="ma__placeholder"> | ||
Right Rail | ||
</div> | ||
</aside> | ||
) | ||
} | ||
</div> | ||
</main> | ||
<div className="ma__placeholder"> | ||
Post Content | ||
</div> | ||
{renderFooter} | ||
</div> | ||
) | ||
} | ||
|
||
const templateSlim = template({renderHeader: headerStories.headerSlimmest(), renderFooter: footerStories.footerSlim()}) | ||
|
||
const templateFullNav = template({renderHeader: headerStories.headerFullNav(), renderFooter: footerStories.footerFullNav(), reversed: true}) | ||
|
||
const notesTemplateSlim = ` | ||
// Link to CSS: | ||
<link rel="stylesheet" href="${STORYBOOK_CDN_PATH}/css/general.css"> | ||
<link rel="stylesheet" href="${STORYBOOK_CDN_PATH}/css/layout.css"> | ||
<link rel="stylesheet" href="${STORYBOOK_CDN_PATH}/css/header-slim.css"> | ||
<link rel="stylesheet" href="${STORYBOOK_CDN_PATH}/css/footer-slim.css"> | ||
` | ||
|
||
const notesTemplate = ` | ||
// Link to CSS: | ||
<link rel="stylesheet" href="${STORYBOOK_CDN_PATH}/css/general.css"> | ||
<link rel="stylesheet" href="${STORYBOOK_CDN_PATH}/css/layout.css"> | ||
<link rel="stylesheet" href="${STORYBOOK_CDN_PATH}/css/header.css"> | ||
<link rel="stylesheet" href="${STORYBOOK_CDN_PATH}/css/footer.css"> | ||
// Link to JS: | ||
<script type="text/javascript" src="${STORYBOOK_CDN_PATH}/js/header.js" /> | ||
` | ||
|
||
export const notesTemplateCSS = ` | ||
<head> | ||
<!-- Mayflower fonts and other basic styles --> | ||
<link rel="stylesheet" href="${STORYBOOK_CDN_PATH}/css/general.css"> | ||
<!-- Mayflower page layout styles --> | ||
<link rel="stylesheet" href="${STORYBOOK_CDN_PATH}/css/layout.css"> | ||
<!-- Add Mayflower Header and Footer specific styles --> | ||
</head> | ||
` | ||
|
||
export const notesTemplateJS = ` | ||
<!-- Add Header JS (if any)--> | ||
` | ||
|
||
export const templateBasic = () => templateSlim; | ||
attachHTML(templateBasic, templateSlim, notesTemplateSlim) | ||
|
||
|
||
export const templateFull = () => templateFullNav; | ||
attachHTML(templateFull, templateFullNav, notesTemplate) |
56 changes: 56 additions & 0 deletions
56
packages/core/stories/components/Template/Template.stories.mdx
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,56 @@ | ||
import { Meta, Story, Canvas, Source } from '@storybook/addon-docs/blocks'; | ||
import { linkTo } from '@storybook/addon-links'; | ||
|
||
import generateTitle from '../../util/generateTitle'; | ||
import * as stories from './Template.stories.js'; | ||
import { renderReactMarkup } from '../../util/renderCode'; | ||
|
||
<Meta | ||
title={generateTitle('Template')} | ||
parameters={{ | ||
viewMode: 'docs' | ||
}} | ||
/> | ||
|
||
# Template | ||
|
||
The templates demostrates how to assemble a page with a Mayflower Header, Footer and a basic page layout. | ||
|
||
> Refer to <button onClick={linkTo(generateTitle('Header'))}>Header</button> and <button onClick={linkTo(generateTitle('Footer'))}>Footer</button>, copy and paste the Header and Footert HTML, CSS and JS (if any) into the template snippet. | ||
<Source code={ | ||
` | ||
${stories.notesTemplateCSS} | ||
<body> | ||
${renderReactMarkup(stories.template({renderHeader: '// Insert Header HTML here', renderFooter: '// Insert Footer HTML here'}))} | ||
${stories.notesTemplateJS} | ||
</body> | ||
` | ||
} /> | ||
|
||
|
||
## Usage | ||
To kick-start a page in HTML: | ||
1. Copy the code above or jump to an example below and click on "Show code" to copy the HTML snippet from the example | ||
4. Add the links to CSS and JS at the appropriate places | ||
- **CSS**: Link to CSS inside the `<head>` | ||
- **JS**: Link to JS before the closing body tag `</body>` | ||
5. Replace the `.ma__placeholder` divs with real content | ||
|
||
|
||
|
||
## Examples | ||
|
||
### Header and Footer (Slim) | ||
A demo page with the Slim Header, Slim Footer, and a layout of a full-width block, and two-column block with a right-rail. | ||
|
||
<Canvas> | ||
<Story story={stories.templateBasic} /> | ||
</Canvas> | ||
|
||
### Header and Footer (With Full Navigation) | ||
A demo page with the Full Nav Header, Full Nav Footer, and a layout of a full-width block, and two-column block with a left-rail. | ||
|
||
<Canvas> | ||
<Story story={stories.templateFull} /> | ||
</Canvas> |
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
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