From 95272db85f2c8f4be3442c1545f74bb2e854d1d1 Mon Sep 17 00:00:00 2001 From: "TECNOSYLVA\\fgarcia" Date: Tue, 21 Feb 2017 17:15:07 +0100 Subject: [PATCH 1/7] Added new component, mdOnboarding --- docs/src/App.vue | 4 + docs/src/pages/components/Onboarding.vue | 69 ++++++ docs/src/routes.js | 6 + src/components/mdOnboarding/index.js | 10 + src/components/mdOnboarding/mdBoard.vue | 105 +++++++++ src/components/mdOnboarding/mdOnboarding.scss | 137 +++++++++++ .../mdOnboarding/mdOnboarding.theme | 94 ++++++++ src/components/mdOnboarding/mdOnboarding.vue | 222 ++++++++++++++++++ src/index.js | 2 + 9 files changed, 649 insertions(+) create mode 100644 docs/src/pages/components/Onboarding.vue create mode 100644 src/components/mdOnboarding/index.js create mode 100644 src/components/mdOnboarding/mdBoard.vue create mode 100644 src/components/mdOnboarding/mdOnboarding.scss create mode 100644 src/components/mdOnboarding/mdOnboarding.theme create mode 100644 src/components/mdOnboarding/mdOnboarding.vue diff --git a/docs/src/App.vue b/docs/src/App.vue index 4e3a9c8..56d6fb0 100644 --- a/docs/src/App.vue +++ b/docs/src/App.vue @@ -99,6 +99,10 @@ Menu + + Onboarding + + Progress diff --git a/docs/src/pages/components/Onboarding.vue b/docs/src/pages/components/Onboarding.vue new file mode 100644 index 0000000..541b213 --- /dev/null +++ b/docs/src/pages/components/Onboarding.vue @@ -0,0 +1,69 @@ + + + diff --git a/docs/src/routes.js b/docs/src/routes.js index 4f220ea..ac0d10e 100644 --- a/docs/src/routes.js +++ b/docs/src/routes.js @@ -21,6 +21,7 @@ const InkRipple = (r) => require.ensure([], () => r(require('./pages/components/ const Input = (r) => require.ensure([], () => r(require('./pages/components/Input')), 'input'); const List = (r) => require.ensure([], () => r(require('./pages/components/List')), 'list'); const Menu = (r) => require.ensure([], () => r(require('./pages/components/Menu')), 'menu'); +const Onboarding = (r) => require.ensure([], () => r(require('./pages/components/Onboarding')), 'onboarding'); const Progress = (r) => require.ensure([], () => r(require('./pages/components/Progress')), 'progress'); const Radio = (r) => require.ensure([], () => r(require('./pages/components/Radio')), 'radio'); const Select = (r) => require.ensure([], () => r(require('./pages/components/Select')), 'select'); @@ -148,6 +149,11 @@ const components = [ name: 'components:menu', component: Menu }, + { + path: '/components/onboarding', + name: 'components:onboarding', + component: Onboarding + }, { path: '/components/progress', name: 'components:progress', diff --git a/src/components/mdOnboarding/index.js b/src/components/mdOnboarding/index.js new file mode 100644 index 0000000..0791a01 --- /dev/null +++ b/src/components/mdOnboarding/index.js @@ -0,0 +1,10 @@ +import mdOnboarding from './mdOnboarding.vue'; +import mdBoard from './mdBoard.vue'; +import mdOnboardingTheme from './mdOnboarding.theme'; + +export default function install(Vue) { + Vue.component('md-onboarding', mdOnboarding); + Vue.component('md-board', mdBoard); + + Vue.material.styles.push(mdOnboardingTheme); +} diff --git a/src/components/mdOnboarding/mdBoard.vue b/src/components/mdOnboarding/mdBoard.vue new file mode 100644 index 0000000..a54cfb9 --- /dev/null +++ b/src/components/mdOnboarding/mdBoard.vue @@ -0,0 +1,105 @@ + + + diff --git a/src/components/mdOnboarding/mdOnboarding.scss b/src/components/mdOnboarding/mdOnboarding.scss new file mode 100644 index 0000000..b842b6f --- /dev/null +++ b/src/components/mdOnboarding/mdOnboarding.scss @@ -0,0 +1,137 @@ +@import '../../core/stylesheets/variables.scss'; + +$tab-width: 72px; +$tab-max-width: 264px; + +.md-tabs { + width: 100%; + display: flex; + flex-flow: column; + position: relative; + + &.md-transition-off * { + transition: none !important; + } + + &.md-dynamic-height { + .md-tabs-content { + transition: height $swift-ease-out-duration $swift-ease-out-timing-function; + } + } + + .md-tabs-navigation { + height: 48px; + min-height: 48px; + position: relative; + z-index: 1; + display: flex; + transition: $swift-ease-out; + + &.md-has-icon.md-has-label { + min-height: 72px; + + .md-icon { + margin-bottom: 10px; + } + } + + &.md-centered { + justify-content: center; + } + + &.md-fixed { + .md-tab-header { + flex: 1; + } + } + + &.md-right { + justify-content: flex-end; + } + } + + .md-tab-header { + min-width: $tab-width; + max-width: $tab-max-width; + margin: 0; + padding: 0 12px; + display: inline-block; + position: relative; + cursor: pointer; + border: 0; + background: none; + transition: $swift-ease-out; + font-family: inherit; + font-size: 14px; + font-weight: 500; + text-transform: uppercase; + + &.md-disabled { + cursor: default; + pointer-events: none; + user-select: none; + -webkit-user-drag: none; + } + } + + .md-tab-header-container { + display: flex; + flex-flow: column; + justify-content: center; + align-items: center; + + .md-icon { + margin: 0; + } + } + + .md-tab-indicator { + height: 2px; + position: absolute; + bottom: 0; + left: 0; + transform: translate3D(0, 0, 0); + + &.md-transition-off { + transition: none !important; + } + + &.md-to-right { + transition: $swift-ease-out, + left .3s $swift-ease-in-out-timing-function, + right .15s $swift-ease-in-out-timing-function; + } + + &.md-to-left { + transition: $swift-ease-out, + right .3s $swift-ease-in-out-timing-function, + left .15s $swift-ease-in-out-timing-function; + } + } + + .md-tabs-content { + width: 100%; + height: 0; + position: relative; + overflow: hidden; + } + + .md-tabs-wrapper { + width: 9999em; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + transform: translate3d(0, 0, 0); + transition: transform $swift-ease-out-duration $swift-ease-out-timing-function; + } + + .md-tab { + padding: 16px; + position: absolute; + top: 0; + left: 0; + right: 0; + } +} diff --git a/src/components/mdOnboarding/mdOnboarding.theme b/src/components/mdOnboarding/mdOnboarding.theme new file mode 100644 index 0000000..e698e05 --- /dev/null +++ b/src/components/mdOnboarding/mdOnboarding.theme @@ -0,0 +1,94 @@ +.THEME_NAME { + &.md-tabs { + > .md-tabs-navigation { + background-color: #{'PRIMARY-COLOR'}; + + .md-tab-header { + color: #{'PRIMARY-CONTRAST-0.54'}; + + &.md-active, + &:focus { + color: #{'PRIMARY-CONTRAST'}; + } + + &.md-disabled { + color: #{'PRIMARY-CONTRAST-0.26'} + } + } + + .md-tab-indicator { + background-color: #{'ACCENT-COLOR'}; + } + } + + &.md-transparent { + > .md-tabs-navigation { + background-color: transparent; + border-bottom: 1px solid #{'BACKGROUND-CONTRAST-0.12'}; + + .md-tab-header { + color: #{'BACKGROUND-CONTRAST-0.54'}; + + &.md-active, + &:focus { + color: #{'PRIMARY-COLOR'}; + } + + &.md-disabled { + color: #{'BACKGROUND-CONTRAST-0.26'} + } + } + + .md-tab-indicator { + background-color: #{'PRIMARY-COLOR'}; + } + } + } + + &.md-accent { + > .md-tabs-navigation { + background-color: #{'ACCENT-COLOR'}; + + .md-tab-header { + color: #{'ACCENT-CONTRAST-0.54'}; + + &.md-active, + &:focus { + color: #{'ACCENT-CONTRAST'}; + } + + &.md-disabled { + color: #{'ACCENT-CONTRAST-0.26'} + } + } + + .md-tab-indicator { + background-color: #{'BACKGROUND-COLOR'}; + } + } + } + + &.md-warn { + > .md-tabs-navigation { + background-color: #{'WARN-COLOR'}; + + .md-tab-header { + color: #{'WARN-CONTRAST-0.54'}; + + &.md-active, + &:focus { + color: #{'WARN-CONTRAST'}; + } + + &.md-disabled { + color: #{'WARN-CONTRAST-0.26'} + } + } + + .md-tab-indicator { + background-color: #{'BACKGROUND-COLOR'}; + } + } + } + } +} diff --git a/src/components/mdOnboarding/mdOnboarding.vue b/src/components/mdOnboarding/mdOnboarding.vue new file mode 100644 index 0000000..2ab8e57 --- /dev/null +++ b/src/components/mdOnboarding/mdOnboarding.vue @@ -0,0 +1,222 @@ + + + + + diff --git a/src/index.js b/src/index.js index 9a0f757..2540f7b 100644 --- a/src/index.js +++ b/src/index.js @@ -16,6 +16,7 @@ import MdInputContainer from './components/mdInputContainer'; import MdLayout from './components/mdLayout'; import MdList from './components/mdList'; import MdMenu from './components/mdMenu'; +import MdOnboarding from './components/mdOnboarding'; import MdProgress from './components/mdProgress'; import MdRadio from './components/mdRadio'; import MdSelect from './components/mdSelect'; @@ -50,6 +51,7 @@ const options = { MdLayout, MdList, MdMenu, + MdOnboarding, MdProgress, MdRadio, MdSelect, From 2928200ba1407a243d87fff1d680102e0e0673e2 Mon Sep 17 00:00:00 2001 From: "TECNOSYLVA\\fgarcia" Date: Wed, 22 Feb 2017 12:09:17 +0100 Subject: [PATCH 2/7] Added custom classes for theming. Added auto timeout behaviour. Finished custom mdOnboarding component based on mdTabs. --- docs/src/pages/components/Onboarding.vue | 157 ++++++++-- src/components/mdOnboarding/index.js | 8 +- src/components/mdOnboarding/mdBoard.vue | 40 +-- .../{mdOnboarding.scss => mdBoards.scss} | 75 ++--- src/components/mdOnboarding/mdBoards.theme | 116 +++++++ src/components/mdOnboarding/mdBoards.vue | 296 ++++++++++++++++++ .../mdOnboarding/mdOnboarding.theme | 94 ------ src/components/mdOnboarding/mdOnboarding.vue | 222 ------------- 8 files changed, 591 insertions(+), 417 deletions(-) rename src/components/mdOnboarding/{mdOnboarding.scss => mdBoards.scss} (55%) create mode 100644 src/components/mdOnboarding/mdBoards.theme create mode 100644 src/components/mdOnboarding/mdBoards.vue delete mode 100644 src/components/mdOnboarding/mdOnboarding.theme delete mode 100644 src/components/mdOnboarding/mdOnboarding.vue diff --git a/docs/src/pages/components/Onboarding.vue b/docs/src/pages/components/Onboarding.vue index 541b213..dc48729 100644 --- a/docs/src/pages/components/Onboarding.vue +++ b/docs/src/pages/components/Onboarding.vue @@ -2,16 +2,20 @@
-

-
    +

    The onboarding offers a first and fast look for your page, with custom controls, automatized steps and swipe effects. Can be also used as a custom carousel.

    +

    Can be themed used the following:

    +
    • md-primary
    • md-warn
    • +
    • md-accent
    • +
    • md-transparent
+ Name @@ -22,41 +26,155 @@ - v-model - String - A required model object to bind the value. + md-auto + Boolean + Enable auto-slider. Default false. + + + + md-infinite + Boolean + Enable infinite loop. Default false. + + + + md-timeout + Number + Set timeout for md-auto in milliseconds. Default 5000. + + + + md-controls + Boolean + Enable prev/next controls. Default false. +
- +
- - + +

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dolorum quas amet cum vitae, omnis! Illum quas voluptatem, expedita iste, dicta ipsum ea veniam dolore in, quod saepe reiciendis nihil.

- -

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dolorum quas amet cum vitae, omnis! Illum quas voluptatem, expedita iste, dicta ipsum ea veniam dolore in, quod saepe reiciendis nihil.

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dolorum quas amet cum vitae, omnis! Illum quas voluptatem, expedita iste, dicta ipsum ea veniam dolore in, quod saepe reiciendis nihil.

- -

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dolorum quas.

+ +

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dolorum quas amet cum vitae, omnis! Illum quas voluptatem, expedita iste, dicta ipsum ea veniam dolore in, quod saepe reiciendis nihil.

- - -

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dolorum quas.

-
-
+
- + <md-boards :md-auto="true" :md-infinite="true"> + <md-board id="slide1"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dolorum quas amet cum vitae, omnis! Illum quas voluptatem, expedita iste, dicta ipsum ea veniam dolore in, quod saepe reiciendis nihil.</p> + </md-board> + + <md-board id="slide2"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dolorum quas amet cum vitae, omnis! Illum quas voluptatem, expedita iste, dicta ipsum ea veniam dolore in, quod saepe reiciendis nihil.</p> + </md-board> + + <md-board id="slide3"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dolorum quas amet cum vitae, omnis! Illum quas voluptatem, expedita iste, dicta ipsum ea veniam dolore in, quod saepe reiciendis nihil.</p> + </md-board> + </md-boards> + +
+
+ + +
+ + +

Transparent themed, for background-imaged slides. Background color black added for demonstration purposes.

+
+ + +

Transparent themed, for background-imaged slides. Background color black added for demonstration purposes.

+
+ + +

Transparent themed, for background-imaged slides. Background color black added for demonstration purposes.

+
+
+ + + +

Primary themed

+
+ + +

Primary themed

+
+
+ + + +

Accent themed

+
+ + +

Accent themed

+
+ + +

Accent themed

+
+
+ + + +

Warn themed

+
+ + +

Warn themed

+
+ + +

Warn themed

+
+ + +

Warn themed

+
+
+
+ +
+ + <md-boards class="md-transparent" :md-controls="true"> + <md-board id="slide1"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dolorum quas amet cum vitae, omnis! Illum quas voluptatem, expedita iste, dicta ipsum ea veniam dolore in, quod saepe reiciendis nihil.</p> + </md-board> + </md-boards> + + <md-boards class="md-primary" :md-controls="true"> + <md-board id="slide1"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dolorum quas amet cum vitae, omnis! Illum quas voluptatem, expedita iste, dicta ipsum ea veniam dolore in, quod saepe reiciendis nihil.</p> + </md-board> + </md-boards> + + <md-boards class="md-accent" :md-controls="true"> + <md-board id="slide1"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dolorum quas amet cum vitae, omnis! Illum quas voluptatem, expedita iste, dicta ipsum ea veniam dolore in, quod saepe reiciendis nihil.</p> + </md-board> + </md-boards> + + <md-boards class="md-warn" :md-controls="true"> + <md-board id="slide1"> + <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dolorum quas amet cum vitae, omnis! Illum quas voluptatem, expedita iste, dicta ipsum ea veniam dolore in, quod saepe reiciendis nihil.</p> + </md-board> + </md-boards>
@@ -64,6 +182,3 @@ - - diff --git a/src/components/mdOnboarding/index.js b/src/components/mdOnboarding/index.js index 0791a01..50dcec3 100644 --- a/src/components/mdOnboarding/index.js +++ b/src/components/mdOnboarding/index.js @@ -1,10 +1,10 @@ -import mdOnboarding from './mdOnboarding.vue'; +import mdBoards from './mdBoards.vue'; import mdBoard from './mdBoard.vue'; -import mdOnboardingTheme from './mdOnboarding.theme'; +import mdBoardsTheme from './mdBoards.theme'; export default function install(Vue) { - Vue.component('md-onboarding', mdOnboarding); + Vue.component('md-boards', mdBoards); Vue.component('md-board', mdBoard); - Vue.material.styles.push(mdOnboardingTheme); + Vue.material.styles.push(mdBoardsTheme); } diff --git a/src/components/mdOnboarding/mdBoard.vue b/src/components/mdOnboarding/mdBoard.vue index a54cfb9..8d244c9 100644 --- a/src/components/mdOnboarding/mdBoard.vue +++ b/src/components/mdOnboarding/mdBoard.vue @@ -1,5 +1,5 @@ @@ -28,32 +28,32 @@ data() { return { mounted: false, - tabId: this.id || 'tab-' + uniqueId(), + boardId: this.id || 'board-' + uniqueId(), width: '0px', left: '0px' }; }, watch: { mdActive() { - this.updateTabData(); + this.updateBoardData(); }, mdDisabled() { - this.updateTabData(); + this.updateBoardData(); }, mdIcon() { - this.updateTabData(); + this.updateBoardData(); }, mdLabel() { - this.updateTabData(); + this.updateBoardData(); }, mdTooltip() { - this.updateTabData(); + this.updateBoardData(); }, mdTooltipDelay() { - this.updateTabData(); + this.updateBoardData(); }, mdTooltipDirection() { - this.updateTabData(); + this.updateBoardData(); } }, computed: { @@ -65,9 +65,9 @@ } }, methods: { - getTabData() { + getBoardData() { return { - id: this.tabId, + id: this.boardId, label: this.mdLabel, icon: this.mdIcon, active: this.mdActive, @@ -78,28 +78,28 @@ ref: this }; }, - updateTabData() { - this.parentTabs.updateTab(this.getTabData()); + updateBoardData() { + this.parentBoards.updateBoard(this.getBoardData()); } }, mounted() { - let tabData = this.getTabData(); + let boardData = this.getBoardData(); - this.parentTabs = getClosestVueParent(this.$parent, 'md-tabs'); + this.parentBoards = getClosestVueParent(this.$parent, 'md-boards'); - if (!this.parentTabs) { - throw new Error('You must wrap the md-tab in a md-tabs'); + if (!this.parentBoards) { + throw new Error('You must wrap the md-board in a md-boards'); } this.mounted = true; - this.parentTabs.updateTab(tabData); + this.parentBoards.updateBoard(boardData); if (this.mdActive) { - this.parentTabs.setActiveTab(tabData); + this.parentBoards.setActiveBoard(boardData); } }, beforeDestroy() { - this.parentTabs.unregisterTab(this.getTabData()); + this.parentBoards.unregisterBoard(this.getBoardData()); } }; diff --git a/src/components/mdOnboarding/mdOnboarding.scss b/src/components/mdOnboarding/mdBoards.scss similarity index 55% rename from src/components/mdOnboarding/mdOnboarding.scss rename to src/components/mdOnboarding/mdBoards.scss index b842b6f..76cd6a7 100644 --- a/src/components/mdOnboarding/mdOnboarding.scss +++ b/src/components/mdOnboarding/mdBoards.scss @@ -1,9 +1,9 @@ @import '../../core/stylesheets/variables.scss'; -$tab-width: 72px; -$tab-max-width: 264px; +$board-width: 24px; +$board-max-width: 24px; -.md-tabs { +.md-boards { width: 100%; display: flex; flex-flow: column; @@ -14,45 +14,24 @@ $tab-max-width: 264px; } &.md-dynamic-height { - .md-tabs-content { + .md-boards-content { transition: height $swift-ease-out-duration $swift-ease-out-timing-function; } } - .md-tabs-navigation { + .md-boards-navigation { height: 48px; min-height: 48px; position: relative; z-index: 1; display: flex; transition: $swift-ease-out; - - &.md-has-icon.md-has-label { - min-height: 72px; - - .md-icon { - margin-bottom: 10px; - } - } - - &.md-centered { - justify-content: center; - } - - &.md-fixed { - .md-tab-header { - flex: 1; - } - } - - &.md-right { - justify-content: flex-end; - } + justify-content: space-between; } - .md-tab-header { - min-width: $tab-width; - max-width: $tab-max-width; + .md-board-header { + min-width: $board-width; + max-width: $board-max-width; margin: 0; padding: 0 12px; display: inline-block; @@ -74,7 +53,7 @@ $tab-max-width: 264px; } } - .md-tab-header-container { + .md-board-header-container { display: flex; flex-flow: column; justify-content: center; @@ -83,40 +62,24 @@ $tab-max-width: 264px; .md-icon { margin: 0; } - } - .md-tab-indicator { - height: 2px; - position: absolute; - bottom: 0; - left: 0; - transform: translate3D(0, 0, 0); - - &.md-transition-off { - transition: none !important; - } - - &.md-to-right { - transition: $swift-ease-out, - left .3s $swift-ease-in-out-timing-function, - right .15s $swift-ease-in-out-timing-function; - } - - &.md-to-left { - transition: $swift-ease-out, - right .3s $swift-ease-in-out-timing-function, - left .15s $swift-ease-in-out-timing-function; + .md-icon:not(.md-control) { + width: 16px; + min-width: 16px; + height: 16px; + min-height: 16px; + font-size: 16px; } } - .md-tabs-content { + .md-boards-content { width: 100%; height: 0; position: relative; overflow: hidden; } - .md-tabs-wrapper { + .md-boards-wrapper { width: 9999em; position: absolute; top: 0; @@ -127,7 +90,7 @@ $tab-max-width: 264px; transition: transform $swift-ease-out-duration $swift-ease-out-timing-function; } - .md-tab { + .md-board { padding: 16px; position: absolute; top: 0; diff --git a/src/components/mdOnboarding/mdBoards.theme b/src/components/mdOnboarding/mdBoards.theme new file mode 100644 index 0000000..2f25932 --- /dev/null +++ b/src/components/mdOnboarding/mdBoards.theme @@ -0,0 +1,116 @@ +.THEME_NAME { + &.md-boards { + > .md-boards-navigation { + background-color: transparent; + + .md-board-header { + color: #{'BACKGROUND-CONTRAST-0.54'}; + + &.md-active, + &:focus { + color: #{'PRIMARY-COLOR'}; + } + + &.md-disabled { + color: #{'BACKGROUND-CONTRAST-0.26'} + } + } + + .md-button { + color: #{'PRIMARY-COLOR'}; + } + } + + &.md-transparent { + > .md-boards-navigation { + background-color: transparent; + + .md-board-header { + color: #{'PRIMARY-CONTRAST-0.54'}; + + &.md-active, + &:focus { + color: #{'PRIMARY-CONTRAST'}; + } + + &.md-disabled { + color: #{'PRIMARY-CONTRAST-0.26'} + } + } + + .md-button { + color: #{'PRIMARY-CONTRAST-0.54'}; + } + } + } + + &.md-primary { + > .md-boards-navigation { + background-color: #{'PRIMARY-COLOR'}; + + .md-board-header { + color: #{'PRIMARY-CONTRAST-0.54'}; + + &.md-active, + &:focus { + color: #{'PRIMARY-CONTRAST'}; + } + + &.md-disabled { + color: #{'PRIMARY-CONTRAST-0.26'} + } + } + + .md-button { + color: #{'PRIMARY-CONTRAST-0.54'}; + } + } + } + + &.md-accent { + > .md-boards-navigation { + background-color: #{'ACCENT-COLOR'}; + + .md-board-header { + color: #{'ACCENT-CONTRAST-0.54'}; + + &.md-active, + &:focus { + color: #{'ACCENT-CONTRAST'}; + } + + &.md-disabled { + color: #{'ACCENT-CONTRAST-0.26'} + } + } + + .md-button { + color: #{'ACCENT-CONTRAST-0.54'}; + } + } + } + + &.md-warn { + > .md-boards-navigation { + background-color: #{'WARN-COLOR'}; + + .md-board-header { + color: #{'WARN-CONTRAST-0.54'}; + + &.md-active, + &:focus { + color: #{'WARN-CONTRAST'}; + } + + &.md-disabled { + color: #{'WARN-CONTRAST-0.26'} + } + } + + .md-button { + color: #{'WARN-CONTRAST-0.54'}; + } + } + } + } +} diff --git a/src/components/mdOnboarding/mdBoards.vue b/src/components/mdOnboarding/mdBoards.vue new file mode 100644 index 0000000..c1aa26b --- /dev/null +++ b/src/components/mdOnboarding/mdBoards.vue @@ -0,0 +1,296 @@ + + + + + diff --git a/src/components/mdOnboarding/mdOnboarding.theme b/src/components/mdOnboarding/mdOnboarding.theme deleted file mode 100644 index e698e05..0000000 --- a/src/components/mdOnboarding/mdOnboarding.theme +++ /dev/null @@ -1,94 +0,0 @@ -.THEME_NAME { - &.md-tabs { - > .md-tabs-navigation { - background-color: #{'PRIMARY-COLOR'}; - - .md-tab-header { - color: #{'PRIMARY-CONTRAST-0.54'}; - - &.md-active, - &:focus { - color: #{'PRIMARY-CONTRAST'}; - } - - &.md-disabled { - color: #{'PRIMARY-CONTRAST-0.26'} - } - } - - .md-tab-indicator { - background-color: #{'ACCENT-COLOR'}; - } - } - - &.md-transparent { - > .md-tabs-navigation { - background-color: transparent; - border-bottom: 1px solid #{'BACKGROUND-CONTRAST-0.12'}; - - .md-tab-header { - color: #{'BACKGROUND-CONTRAST-0.54'}; - - &.md-active, - &:focus { - color: #{'PRIMARY-COLOR'}; - } - - &.md-disabled { - color: #{'BACKGROUND-CONTRAST-0.26'} - } - } - - .md-tab-indicator { - background-color: #{'PRIMARY-COLOR'}; - } - } - } - - &.md-accent { - > .md-tabs-navigation { - background-color: #{'ACCENT-COLOR'}; - - .md-tab-header { - color: #{'ACCENT-CONTRAST-0.54'}; - - &.md-active, - &:focus { - color: #{'ACCENT-CONTRAST'}; - } - - &.md-disabled { - color: #{'ACCENT-CONTRAST-0.26'} - } - } - - .md-tab-indicator { - background-color: #{'BACKGROUND-COLOR'}; - } - } - } - - &.md-warn { - > .md-tabs-navigation { - background-color: #{'WARN-COLOR'}; - - .md-tab-header { - color: #{'WARN-CONTRAST-0.54'}; - - &.md-active, - &:focus { - color: #{'WARN-CONTRAST'}; - } - - &.md-disabled { - color: #{'WARN-CONTRAST-0.26'} - } - } - - .md-tab-indicator { - background-color: #{'BACKGROUND-COLOR'}; - } - } - } - } -} diff --git a/src/components/mdOnboarding/mdOnboarding.vue b/src/components/mdOnboarding/mdOnboarding.vue deleted file mode 100644 index 2ab8e57..0000000 --- a/src/components/mdOnboarding/mdOnboarding.vue +++ /dev/null @@ -1,222 +0,0 @@ - - - - - From f13ccff14b9b47fe9a8d148162984ad1176b6e3f Mon Sep 17 00:00:00 2001 From: "TECNOSYLVA\\fgarcia" Date: Wed, 22 Feb 2017 16:10:14 +0100 Subject: [PATCH 3/7] Fixed some css. --- docs/src/pages/components/Onboarding.vue | 4 ++-- src/components/mdOnboarding/mdBoards.scss | 4 ++++ src/components/mdOnboarding/mdBoards.vue | 12 ++++++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/src/pages/components/Onboarding.vue b/docs/src/pages/components/Onboarding.vue index dc48729..c1a2640 100644 --- a/docs/src/pages/components/Onboarding.vue +++ b/docs/src/pages/components/Onboarding.vue @@ -57,7 +57,7 @@
- +

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dolorum quas amet cum vitae, omnis! Illum quas voluptatem, expedita iste, dicta ipsum ea veniam dolore in, quod saepe reiciendis nihil.

@@ -74,7 +74,7 @@
- <md-boards :md-auto="true" :md-infinite="true"> + <md-boards :md-auto="true" :md-infinite="true" :md-duration="3000"> <md-board id="slide1"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dolorum quas amet cum vitae, omnis! Illum quas voluptatem, expedita iste, dicta ipsum ea veniam dolore in, quod saepe reiciendis nihil.</p> </md-board> diff --git a/src/components/mdOnboarding/mdBoards.scss b/src/components/mdOnboarding/mdBoards.scss index 76cd6a7..f313bdb 100644 --- a/src/components/mdOnboarding/mdBoards.scss +++ b/src/components/mdOnboarding/mdBoards.scss @@ -5,6 +5,7 @@ $board-max-width: 24px; .md-boards { width: 100%; + height: 100%; display: flex; flex-flow: column; position: relative; @@ -20,6 +21,9 @@ $board-max-width: 24px; } .md-boards-navigation { + position: absolute !important; + bottom: 0; + width: 100%; height: 48px; min-height: 48px; position: relative; diff --git a/src/components/mdOnboarding/mdBoards.vue b/src/components/mdOnboarding/mdBoards.vue index c1aa26b..811a0d5 100644 --- a/src/components/mdOnboarding/mdBoards.vue +++ b/src/components/mdOnboarding/mdBoards.vue @@ -7,7 +7,7 @@
- +
@@ -76,7 +76,7 @@ type: Boolean, default: false }, - mdTimeout: { + mdDuration: { type: Number, default: 5000 }, @@ -282,7 +282,7 @@ if (this.mdAuto) { this.autoTransition = window.setInterval(() => { this.moveNextBoard(); - }, this.mdTimeout); + }, this.mdDuration); } }, beforeDestroy() { @@ -290,6 +290,10 @@ this.parentObserver.disconnect(); } + if (this.autoTransition) { + window.clearTimeout(this.autoTransition); + } + window.removeEventListener('resize', this.calculateOnResize); } }; From 1699134475f310543ec657769dd58a50894a7c06 Mon Sep 17 00:00:00 2001 From: "TECNOSYLVA\\fgarcia" Date: Wed, 22 Feb 2017 17:31:03 +0100 Subject: [PATCH 4/7] Added docs css. Added clearInterval when user clicks on dot to restart timer duration. --- docs/src/pages/components/Onboarding.vue | 8 +++++++- src/components/mdOnboarding/mdBoards.vue | 19 ++++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/docs/src/pages/components/Onboarding.vue b/docs/src/pages/components/Onboarding.vue index c1a2640..7fb5875 100644 --- a/docs/src/pages/components/Onboarding.vue +++ b/docs/src/pages/components/Onboarding.vue @@ -57,7 +57,7 @@
- +

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dolorum quas amet cum vitae, omnis! Illum quas voluptatem, expedita iste, dicta ipsum ea veniam dolore in, quod saepe reiciendis nihil.

@@ -182,3 +182,9 @@ + + diff --git a/src/components/mdOnboarding/mdBoards.vue b/src/components/mdOnboarding/mdBoards.vue index 811a0d5..a95b466 100644 --- a/src/components/mdOnboarding/mdBoards.vue +++ b/src/components/mdOnboarding/mdBoards.vue @@ -28,7 +28,7 @@ class="md-board-header" :class="getHeaderClass(header)" :disabled="header.disabled" - @click="setActiveBoard(header)" + @click="setActiveBoard(header, true)" ref="boardHeader">
fiber_manual_record @@ -231,7 +231,18 @@ this.transitionOff = true; this.calculateOnWatch(); }, - setActiveBoard(boardData) { + start() { + if (this.autoTransition) { + window.clearInterval(this.autoTransition); + } + this.autoTransition = window.setInterval(() => { + this.moveNextBoard(); + }, this.mdDuration); + }, + setActiveBoard(boardData, reset) { + if (reset) { + this.start(); + } this.hasIcons = !!boardData.icon; this.hasLabel = !!boardData.label; this.activeBoard = boardData.id; @@ -280,9 +291,7 @@ /* automatic behaviour */ if (this.mdAuto) { - this.autoTransition = window.setInterval(() => { - this.moveNextBoard(); - }, this.mdDuration); + this.start(); } }, beforeDestroy() { From fe7333ec850f29711f711b82045fa3c5259bc738 Mon Sep 17 00:00:00 2001 From: "TECNOSYLVA\\fgarcia" Date: Wed, 22 Feb 2017 17:37:33 +0100 Subject: [PATCH 5/7] Added force restart timer to control buttons as well. --- src/components/mdOnboarding/mdBoards.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/mdOnboarding/mdBoards.vue b/src/components/mdOnboarding/mdBoards.vue index a95b466..a3ab626 100644 --- a/src/components/mdOnboarding/mdBoards.vue +++ b/src/components/mdOnboarding/mdBoards.vue @@ -256,11 +256,11 @@ let target = boardsIds[targetIndex]; if (target) { - this.setActiveBoard(this.boardList[target]); + this.setActiveBoard(this.boardList[target], true); } else if (this.mdInfinite) { let lastBoard = Object.keys(this.boardList)[Object.keys(this.boardList).length - 1]; - this.setActiveBoard(this.boardList[lastBoard]); + this.setActiveBoard(this.boardList[lastBoard], true); } }, moveNextBoard() { @@ -269,11 +269,11 @@ let target = boardsIds[targetIndex]; if (target) { - this.setActiveBoard(this.boardList[target]); + this.setActiveBoard(this.boardList[target], true); } else if (this.mdInfinite) { let firstBoard = Object.keys(this.boardList)[0]; - this.setActiveBoard(this.boardList[firstBoard]); + this.setActiveBoard(this.boardList[firstBoard], true); } } }, From 6f933d21ea96044a490add968018c3fe397f50b0 Mon Sep 17 00:00:00 2001 From: "TECNOSYLVA\\fgarcia" Date: Thu, 23 Feb 2017 15:26:53 +0100 Subject: [PATCH 6/7] Added swipeable functionality. --- docs/src/pages/components/Onboarding.vue | 22 ++++++-- src/components/mdOnboarding/mdBoards.vue | 69 +++++++++++++++++++++--- 2 files changed, 78 insertions(+), 13 deletions(-) diff --git a/docs/src/pages/components/Onboarding.vue b/docs/src/pages/components/Onboarding.vue index 7fb5875..2bb5fc0 100644 --- a/docs/src/pages/components/Onboarding.vue +++ b/docs/src/pages/components/Onboarding.vue @@ -38,9 +38,9 @@ - md-timeout + md-duration Number - Set timeout for md-auto in milliseconds. Default 5000. + Set duration for md-auto in milliseconds. Default 5000. @@ -48,6 +48,18 @@ Boolean Enable prev/next controls. Default false. + + + md-swipeable + Boolean + Enable the swipe functionality. Default false. + + + + md-swipe-distance + Number + Set the swipe distance needed to open/close the sidenav. Default 100. + @@ -55,9 +67,9 @@
- +
- +

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dolorum quas amet cum vitae, omnis! Illum quas voluptatem, expedita iste, dicta ipsum ea veniam dolore in, quod saepe reiciendis nihil.

@@ -74,7 +86,7 @@
- <md-boards :md-auto="true" :md-infinite="true" :md-duration="3000"> + <md-boards :md-auto="true" :md-infinite="true" :md-duration="5000" :md-swipeable="true"> <md-board id="slide1"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dolorum quas amet cum vitae, omnis! Illum quas voluptatem, expedita iste, dicta ipsum ea veniam dolore in, quod saepe reiciendis nihil.</p> </md-board> diff --git a/src/components/mdOnboarding/mdBoards.vue b/src/components/mdOnboarding/mdBoards.vue index a3ab626..ff3483d 100644 --- a/src/components/mdOnboarding/mdBoards.vue +++ b/src/components/mdOnboarding/mdBoards.vue @@ -1,7 +1,7 @@