From 59537efc7b8fda5c58f70fbfbb5ce152400ee1b1 Mon Sep 17 00:00:00 2001 From: Minghua Sun Date: Thu, 3 Dec 2020 11:56:23 -0500 Subject: [PATCH] Core/template docs (#1285) * 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 --- common/config/rush/command-line.json | 8 ++ .../assets/scss/01-atoms/_place-holder.scss | 8 ++ packages/core/stories/about/Usage.stories.mdx | 19 +++- .../components/Header/Header.stories.js | 2 +- .../components/Template/Template.stories.js | 100 ++++++++++++++++++ .../components/Template/Template.stories.mdx | 56 ++++++++++ packages/core/stories/meta.json | 4 + packages/core/stories/styles/index.scss | 3 + packages/core/stories/util/renderCode.js | 2 +- 9 files changed, 199 insertions(+), 3 deletions(-) create mode 100644 packages/assets/scss/01-atoms/_place-holder.scss create mode 100644 packages/core/stories/components/Template/Template.stories.js create mode 100644 packages/core/stories/components/Template/Template.stories.mdx diff --git a/common/config/rush/command-line.json b/common/config/rush/command-line.json index 0e21c57be6..f098ff505a 100644 --- a/common/config/rush/command-line.json +++ b/common/config/rush/command-line.json @@ -11,6 +11,14 @@ * "rush my-global-command --help". */ "commands": [ + { + "commandKind": "global", + "name": "build:assets", + "summary": "Runs 'rushx build' for the assets package.", + "safeForSimultaneousRushProcesses": true, + "allowWarningsInSuccessfulBuild": true, + "shellCommand": "cd packages/assets && rushx build" + }, { "commandKind": "global", "name": "start:react", diff --git a/packages/assets/scss/01-atoms/_place-holder.scss b/packages/assets/scss/01-atoms/_place-holder.scss new file mode 100644 index 0000000000..ec84fd360c --- /dev/null +++ b/packages/assets/scss/01-atoms/_place-holder.scss @@ -0,0 +1,8 @@ +.ma__placeholder { + color:#bbb; + min-height:200px; + border:4px dashed #ddd; + font-size:2rem; + line-height:200px; + text-align:center; +} diff --git a/packages/core/stories/about/Usage.stories.mdx b/packages/core/stories/about/Usage.stories.mdx index 129a0e72d0..89515fb9b8 100644 --- a/packages/core/stories/about/Usage.stories.mdx +++ b/packages/core/stories/about/Usage.stories.mdx @@ -1,4 +1,8 @@ import { Meta } from '@storybook/addon-docs/blocks'; +import { linkTo } from '@storybook/addon-links'; +import { + Button +} from '@massds/mayflower-react'; import generateTitle from '../util/generateTitle'; const { STORYBOOK_CDN_PATH, STORYBOOK_CDN, STORYBOOK_PKG } = process.env; @@ -105,9 +109,22 @@ For examples: +
+ ## Build with Mayflower -To import fonts and get started with basic Mayflower layout CSS, import `scss/global.scss` (`@use scss/global.scss`) or link to the compiled `static/fonts/css/global.css` (or the minified version, global.min.css). To use a Mayflower branding component on your site, go to the documentation of the component and copy and paste the html and link to the CDN version of CSS and JS files in the head of your HTML. You can also host the CSS and JS downloaded from mayflower assets package. +To start building with Mayflower in HTML, start by importing the global styles and then incrementally add the styles and JS for each Mayflower component: + +- To import fonts and get started with basic Mayflower styles, link to the compiled `css/global.css` (or the minified version, `css/global.min.css`) from the @massds/mayflower-assets package or the assets CDN. + +- To include basic page layout styles from Mayflower, link to the compiled `css/layout.css` (or the minified version, `css/layout.min.css`) from the @massds/mayflower-assets package or the assets CDN. + +- To use a Mayflower branding component on your site, go to the documentation of the component and copy and paste the HTML code snippet and link to the CDN version of CSS and JS files in the head of your HTML. You can also host the CSS and JS downloaded from mayflower assets package. + +To kickstart a web page with Mayflower Header, Footer, basic layout and styles: + + +
## Configure Your Theme diff --git a/packages/core/stories/components/Header/Header.stories.js b/packages/core/stories/components/Header/Header.stories.js index 6711d6bc67..01fcdc8ad0 100644 --- a/packages/core/stories/components/Header/Header.stories.js +++ b/packages/core/stories/components/Header/Header.stories.js @@ -302,7 +302,7 @@ const notesHeaderSlim = ` const notesHeader = ` // Link to CSS: - // Link to JS: