diff --git a/docs/src/App.vue b/docs/src/App.vue index 4e3a9c8..a9f2e60 100644 --- a/docs/src/App.vue +++ b/docs/src/App.vue @@ -107,6 +107,10 @@ Radio + + Rating Bar + + Select diff --git a/docs/src/assets/icon-home-back.png b/docs/src/assets/icon-home-back.png new file mode 100644 index 0000000..41adfdb Binary files /dev/null and b/docs/src/assets/icon-home-back.png differ diff --git a/docs/src/assets/icon-home-front.png b/docs/src/assets/icon-home-front.png new file mode 100644 index 0000000..df7533f Binary files /dev/null and b/docs/src/assets/icon-home-front.png differ diff --git a/docs/src/pages/components/RatingBar.vue b/docs/src/pages/components/RatingBar.vue new file mode 100644 index 0000000..cba269c --- /dev/null +++ b/docs/src/pages/components/RatingBar.vue @@ -0,0 +1,304 @@ + + + + + diff --git a/docs/src/routes.js b/docs/src/routes.js index 4f220ea..1753e43 100644 --- a/docs/src/routes.js +++ b/docs/src/routes.js @@ -23,6 +23,7 @@ const List = (r) => require.ensure([], () => r(require('./pages/components/List' const Menu = (r) => require.ensure([], () => r(require('./pages/components/Menu')), 'menu'); const Progress = (r) => require.ensure([], () => r(require('./pages/components/Progress')), 'progress'); const Radio = (r) => require.ensure([], () => r(require('./pages/components/Radio')), 'radio'); +const RatingBar = (r) => require.ensure([], () => r(require('./pages/components/RatingBar')), 'rating-bar'); const Select = (r) => require.ensure([], () => r(require('./pages/components/Select')), 'select'); const Sidenav = (r) => require.ensure([], () => r(require('./pages/components/Sidenav')), 'sidenav'); const Snackbar = (r) => require.ensure([], () => r(require('./pages/components/Snackbar')), 'snackbar'); @@ -158,6 +159,11 @@ const components = [ name: 'components:radio', component: Radio }, + { + path: '/components/rating-bar', + name: 'components:rating-bar', + component: RatingBar + }, { path: '/components/select', name: 'components:select', diff --git a/src/components/mdRatingBar/index.js b/src/components/mdRatingBar/index.js new file mode 100644 index 0000000..6f8dc7d --- /dev/null +++ b/src/components/mdRatingBar/index.js @@ -0,0 +1,8 @@ +import mdRatingBar from './mdRatingBar.vue'; +import mdRatingBarTheme from './mdRatingBar.theme'; + +export default function install(Vue) { + Vue.component('md-rating-bar', mdRatingBar); + + Vue.material.styles.push(mdRatingBarTheme); +} diff --git a/src/components/mdRatingBar/mdRatingBar.scss b/src/components/mdRatingBar/mdRatingBar.scss new file mode 100644 index 0000000..85e8ade --- /dev/null +++ b/src/components/mdRatingBar/mdRatingBar.scss @@ -0,0 +1,40 @@ +@import '../../core/stylesheets/variables.scss'; + +$button-radius: 2px; + +.md-rating-bar { + width: auto; + display: flex; + width: fit-content; + padding: 3px; + border-radius: 2px; + + > .md-full-icon { + overflow-x: hidden; + display: inherit; + } + + > .md-empty-icon, + > .md-full-icon { + > .md-icon { + margin: 0; + white-space: nowrap; + cursor: pointer; + } + } + + &:not([disabled]) { + &:hover{ + background-color: rgba(#999, .2); + } + } + + &[disabled] { + > .md-empty-icon, + > .md-full-icon { + > .md-icon { + cursor: default; + } + } + } +} diff --git a/src/components/mdRatingBar/mdRatingBar.theme b/src/components/mdRatingBar/mdRatingBar.theme new file mode 100644 index 0000000..7008f69 --- /dev/null +++ b/src/components/mdRatingBar/mdRatingBar.theme @@ -0,0 +1,24 @@ +.THEME_NAME { + &.md-rating-bar { + > .md-empty-icon .md-icon { + color: #{'BACKGROUND-CONTRAST-0.26'}; + } + + > .md-full-icon .md-icon { + color: #{'BACKGROUND-CONTRAST-0.38'}; + } + + &.md-primary > .md-full-icon .md-icon { + color: #{'PRIMARY-COLOR'}; + } + + &.md-accent > .md-full-icon .md-icon { + color: #{'ACCENT-COLOR'}; + + } + + &.md-warn > .md-full-icon .md-icon { + color: #{'WARN-COLOR'}; + } + } +} diff --git a/src/components/mdRatingBar/mdRatingBar.vue b/src/components/mdRatingBar/mdRatingBar.vue new file mode 100644 index 0000000..fb01438 --- /dev/null +++ b/src/components/mdRatingBar/mdRatingBar.vue @@ -0,0 +1,173 @@ + + + + + diff --git a/src/index.js b/src/index.js index 9a0f757..7148d71 100644 --- a/src/index.js +++ b/src/index.js @@ -18,6 +18,7 @@ import MdList from './components/mdList'; import MdMenu from './components/mdMenu'; import MdProgress from './components/mdProgress'; import MdRadio from './components/mdRadio'; +import MdRatingBar from './components/mdRatingBar'; import MdSelect from './components/mdSelect'; import MdSidenav from './components/mdSidenav'; import MdSnackbar from './components/mdSnackbar'; @@ -52,6 +53,7 @@ const options = { MdMenu, MdProgress, MdRadio, + MdRatingBar, MdSelect, MdSidenav, MdSnackbar,