Skip to content

Commit

Permalink
Merge branch 'master' of github.com:vuematerial/vue-material-experiments
Browse files Browse the repository at this point in the history
* 'master' of github.com:vuematerial/vue-material-experiments:
  fix backslash in template literals (#12)
  docs(MdSpeedDial): finish initial documentation
  docs(MdSpeedDial): add documentation for speed dial root component
  refactor: create a prop validator and apply to all components that needs it
  docs: improve code examples
  docs(MdSpeedDial): improve morph examples
  feat(MdSpeedDial): create morph icon
  feat(MdSpeedDial): add centered fab and speed dial
  feat(MdSpeedDial): add animation types, directions and event triggers
  feat(MdSpeedDial): start creation of speed dial
  style: fix lint issues
  comp(MdSpeedDial): create speed dial files
  • Loading branch information
marcosmoura committed Aug 31, 2017
2 parents fd6fb79 + 183e33d commit 30923dc
Show file tree
Hide file tree
Showing 28 changed files with 889 additions and 96 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ node_modules/
coverage/
.vscode/
.nyc_output/
.vscode/
yarn-debug.log
npm-debug.log
2 changes: 1 addition & 1 deletion build/local/loaders/component-example-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function camelCaseToDash (str) {
module.exports = function (source) {
this.cacheable && this.cacheable()

const filePath = this.resourcePath
const filePath = this.resourcePath.replace(/\\/g, '/')
const fileName = camelCaseToDash(path.basename(filePath).replace('.vue', ''))
const parsedComponent = compiler.parseComponent(source)
const parsedTags = {}
Expand Down
8 changes: 4 additions & 4 deletions docs/app/components/CodeBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@
.hljs {
color: md-get-palette-color(grey, 200);
font-family: "Roboto Mono", "Liberation Mono", Monaco, monospace;
font-size: 16px;
font-family: "Roboto Mono", monospace;
font-size: 15px;
font-weight: 500;
letter-spacing: normal;
line-height: 1.4em;
text-shadow: 0 0 1px rgba(md-get-palette-color(grey, 200), .1);
line-height: 1.5em;
}
.hljs-comment,
Expand Down
3 changes: 3 additions & 0 deletions docs/app/i18n/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ export default {
switch: {
title: 'Switch'
},
speedDial: {
title: 'Speed Dial'
},
subheader: {
title: 'Subheader'
},
Expand Down
10 changes: 5 additions & 5 deletions docs/app/pages/Components/App/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,35 +116,35 @@ export default {
name: 'md-mode="fixed"',
type: 'String',
description: 'Make the toolbar fixed without any scrolling effect',
defaults: 'null'
defaults: '-'
},
{
offset: true,
name: 'md-mode="fixed-last"',
type: 'String',
description: 'Keep the second row of the toolbar fixed and always visible. This NEEDS two md-toolbar-row inside the Toolbar.',
defaults: 'null'
defaults: '-'
},
{
offset: true,
name: 'md-mode="reveal"',
type: 'String',
description: 'Hide the toolbar temporarily and show it after the scroll. This is a good approach for mobile.',
defaults: 'null'
defaults: '-'
},
{
offset: true,
name: 'md-mode="flexible"',
type: 'String',
description: 'Make the height and the title size flexible to give the content a higher priority',
defaults: 'null'
defaults: '-'
},
{
offset: true,
name: 'md-mode="overlap"',
type: 'String',
description: 'Enable the overlapping content',
defaults: 'null'
defaults: '-'
},
{
name: 'md-waterfall',
Expand Down
8 changes: 8 additions & 0 deletions docs/app/pages/Components/Button/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ export default {
name: 'md-fab-top-right',
description: 'Position the FAB on the top right of the nearest relative parent'
},
{
name: 'md-fab-top-center',
description: 'Position the FAB on the top center of the nearest relative parent'
},
{
name: 'md-fab-top-left',
description: 'Position the FAB on the top left of the nearest relative parent'
Expand All @@ -173,6 +177,10 @@ export default {
name: 'md-fab-bottom-right',
description: 'Position the FAB on the bottom right of the nearest relative parent'
},
{
name: 'md-fab-bottom-center',
description: 'Position the FAB on the bottom center of the nearest relative parent'
},
{
name: 'md-fab-bottom-left',
description: 'Position the FAB on the bottom left of the nearest relative parent'
Expand Down
5 changes: 0 additions & 5 deletions docs/app/pages/Components/Card/examples/MediaCover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@
<span class="md-title">Title goes here</span>
<span class="md-subhead">4/3 image</span>
</md-card-header>

<md-card-actions>
<md-button>Action</md-button>
<md-button>Action</md-button>
</md-card-actions>
</md-card-area>
</md-card-media-cover>
</md-card>
Expand Down
175 changes: 175 additions & 0 deletions docs/app/pages/Components/SpeedDial/SpeedDial.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
<example src="./examples/PositionDirection.vue" />
<example src="./examples/AnimationTypes.vue" />
<example src="./examples/EventTriggers.vue" />
<example src="./examples/MorphingIcon.vue" />

<template>
<page-container centered :title="$t('pages.speedDial.title')">
<div class="page-container-section">
<p>Floating action buttons can show related actions upon hover or press. The button should remain on screen after the menu is invoked.</p>
<p>Speed dial component is a lot flexible and have many options to make it easy to suit all your needs. You can apply different positions, work with a couple of events to trigger the content and also have a awesome morph effect on your main action.</p>
<p>The component is divided in 3 parts: The <code>md-speed-dial</code>, which is the container that control all children, <code>md-speed-dial-content</code> which is the content to be displayed (a.k.a buttons) and <code>md-speed-dial-trigger</code> who is responsible for trigger the content exhibition. Take a look at this following example:</p>
</div>

<div class="page-container-section">
<h2>Speed Dial positions</h2>
<p>You can specify any position that you want for you Speed Dial component. They can be top and bottom, and combined with left, center or right:</p>

<code-example title="Positions and directions" :component="examples['position-direction']" />
<note-block tip>Prefer the FAB on bottom left position for your main action on scrollable contents. Always use a <code>md-direction</code> equals to <code>bottom</code> when using top position.</note-block>
</div>

<div class="page-container-section">
<h2>Effects</h2>
<p>The component can be displayed different animations for each scenario that you may want:</p>
<code-example title="Animations types" :component="examples['animation-types']" />
</div>

<div class="page-container-section">
<h2>Triggers</h2>
<p>You can trigger the speed dial content using hover or click. Using this allows you to have a open/close feature or to hold a main action:</p>
<code-example title="Event triggers" :component="examples['event-triggers']" />
<note-block tip>For desktop environments it's better to have a hover effect. On mobile you can toggle the property to use click instead.</note-block>

<api-item title="API - md-speed-dial">
<api-table :headings="props.headings" :props="props.props" slot="props" />
<api-table :headings="classes.headings" :props="classes.props" slot="classes" />
</api-item>
</div>

<div class="page-container-section">
<h2>Icon Morph</h2>

<p>Sometimes you want the speed dial to have a cross icon to represent your close action after showing the content. This can be easily achieved with the morph icons.</p>
<p>To create that, create two <code>md-icon</code> components inside the trigger and add a <code>md-morph-initial</code> in the one you would like it to be the initial state (or a open state) and a <code>md-morph-final</code> on the close state:</p>
<code-example title="Morphing Icons" :component="examples['morphing-icon']" />
</div>

<div class="page-container-section">
<h3>Components</h3>

<api-item title="API - md-speed-dial-content">
<p>This component do not have any extra option.</p>
</api-item>

<api-item title="API - md-speed-dial-trigger">
<p>This component is just an alias of <code>md-button</code> with <code>md-fab</code> class. So every option of <router-link to="/components/button">Buttons</router-link> can be applied here, even the Vue Router options...</p>
</api-item>
</div>
</page-container>
</template>

<script>
import examples from 'docs-mixins/docsExample'
export default {
name: 'SpeedDial',
mixins: [examples],
data: () => ({
props: {
headings: ['Name', 'Description', 'Default'],
props: [
{
name: 'md-direction',
type: 'String',
description: 'Apply the style to show the content below or above the trigger',
defaults: 'top'
}, {
offset: true,
name: 'md-direction="top"',
type: 'String',
description: 'Set the direction of the animation effect to top. This is the default value of md-direction. You don\'t have to pass it unless you want to reset it\'s default value',
defaults: '-'
},
{
offset: true,
name: 'md-direction="bottom"',
type: 'String',
description: 'Set the direction of the animation effect to bottom.',
defaults: '-'
},
{
name: 'md-effect',
type: 'Boolean',
description: 'Enable/Disable the ripple effect.',
defaults: 'fling'
},
{
offset: true,
name: 'md-effect="fling"',
type: 'String',
description: 'Apply a reveal effect combining both opacity and scale. This is the default behaviour in most of applications using FAB.',
defaults: '-'
},
{
offset: true,
name: 'md-effect="scale"',
type: 'String',
description: 'Apply a reveal effect using scale only.',
defaults: '-'
},
{
offset: true,
name: 'md-effect="opacity"',
type: 'String',
description: 'Apply a reveal effect using opacity only.',
defaults: '-'
},
{
name: 'md-event',
type: 'String',
description: 'Specify the event who triggers the content',
defaults: 'hover'
},
{
offset: true,
name: 'md-event="hover"',
type: 'String',
description: 'Open the content on hover.',
defaults: '-'
},
{
offset: true,
name: 'md-event="click"',
type: 'String',
description: 'Open the content on click.',
defaults: '-'
}
]
},
classes: {
headings: ['Name', 'Description'],
props: [
{
name: 'md-top-right',
description: 'Position the Speed Dial on the top right of the nearest relative parent'
},
{
name: 'md-top-center',
description: 'Position the Speed Dial on the top center of the nearest relative parent'
},
{
name: 'md-top-left',
description: 'Position the Speed Dial on the top left of the nearest relative parent'
},
{
name: 'md-bottom-right',
description: 'Position the Speed Dial on the bottom right of the nearest relative parent'
},
{
name: 'md-bottom-center',
description: 'Position the Speed Dial on the bottom center of the nearest relative parent'
},
{
name: 'md-bottom-left',
description: 'Position the Speed Dial on the bottom left of the nearest relative parent'
},
{
name: 'md-fixed',
description: 'Apply css "position: fixed" to Speed Dial. Better used with the 4 position coordinates above'
}
]
}
})
}
</script>
70 changes: 70 additions & 0 deletions docs/app/pages/Components/SpeedDial/examples/AnimationTypes.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<template>
<div class="example">
Fling effect:
<md-speed-dial md-direction="bottom">
<md-speed-dial-target>
<md-icon>add</md-icon>
</md-speed-dial-target>

<md-speed-dial-content>
<md-button class="md-icon-button">
<md-icon>note</md-icon>
</md-button>

<md-button class="md-icon-button">
<md-icon>event</md-icon>
</md-button>
</md-speed-dial-content>
</md-speed-dial>

Scale effect:
<md-speed-dial md-effect="scale" md-direction="bottom">
<md-speed-dial-target class="md-primary">
<md-icon>my_location</md-icon>
</md-speed-dial-target>

<md-speed-dial-content>
<md-button class="md-icon-button">
<md-icon>directions</md-icon>
</md-button>

<md-button class="md-icon-button">
<md-icon>streetview</md-icon>
</md-button>
</md-speed-dial-content>
</md-speed-dial>

Opacity effect:
<md-speed-dial md-effect="opacity" md-direction="bottom">
<md-speed-dial-target class="md-plain">
<md-icon>edit</md-icon>
</md-speed-dial-target>

<md-speed-dial-content>
<md-button class="md-icon-button">
<md-icon>attachment</md-icon>
</md-button>

<md-button class="md-icon-button">
<md-icon>archive</md-icon>
</md-button>
</md-speed-dial-content>
</md-speed-dial>
</div>
</template>

<script>
export default {
name: 'AnimationTypes'
}
</script>

<style lang="scss" scoped>
.example {
min-height: 180px;
}
.md-speed-dial {
margin: 0 24px 0 8px;
}
</style>

0 comments on commit 30923dc

Please sign in to comment.