|
1 | 1 | <template> |
2 | 2 | <div :id="position + '-wrapper'" class="fab-wrapper" v-on-clickaway="away" |
3 | | - :style="[pos, {zIndex: zIndex}]"> |
| 3 | + :style="[ pos, {zIndex: zIndex}, {position: positionType} ]"> |
4 | 4 | <div :id="position + '-action'" class="actions-container" :style="listPos"> |
5 | 5 | <transition name="fab-actions-appear" |
6 | 6 | :enter-active-class="transitionEnter" |
|
14 | 14 | > |
15 | 15 | <template v-if="action.tooltip"> |
16 | 16 | <li v-if="toggle" :style="{ 'background-color': action.color || bgColor }" |
17 | | - v-tooltip="{ content: action.tooltip, placement: tooltipPosition }" |
| 17 | + v-tooltip="{ content: action.tooltip, placement: tooltipPosition, classes: 'fab-tooltip' }" |
18 | 18 | @click="toParent(action.name)" class="pointer"> |
19 | | - <i class="material-icons">{{action.icon}}</i> |
| 19 | + <i :class="[ actionIconSize ,'material-icons']">{{action.icon}}</i> |
20 | 20 | </li> |
21 | 21 | </template> |
22 | 22 | <template v-else> |
23 | 23 | <li v-if="toggle" :style="{ 'background-color': action.color || bgColor }" |
24 | 24 | @click="toParent(action.name)" class="pointer"> |
25 | | - <i class="material-icons">{{action.icon}}</i> |
| 25 | + <i :class="[ actionIconSize ,'material-icons']">{{action.icon}}</i> |
26 | 26 | </li> |
27 | 27 | </template> |
28 | 28 | </transition> |
|
33 | 33 | <template v-if="rippleShow"> |
34 | 34 | <template v-if="mainTooltip"> |
35 | 35 | <div v-ripple="rippleColor == 'light' ? 'rgba(255, 255, 255, 0.35)' : ''" @click="toggle = !toggle" |
36 | | - v-tooltip="{ content: mainTooltip, placement: tooltipPosition }" |
37 | | - class="fab pointer" :style="{ 'background-color': bgColor }" |
| 36 | + v-tooltip="{ content: mainTooltip, placement: tooltipPosition, classes: 'fab-tooltip' }" |
| 37 | + class="fab pointer" :style="{ 'background-color': bgColor, 'padding': paddingAmount }" |
38 | 38 | > |
39 | | - <i class="material-icons md-36 main" :class="{ rotate: toggle }">{{mainIcon}}</i> |
40 | | - <i class="material-icons md-36 close" :class="{ rotate: toggle }">add</i> |
| 39 | + <i :class="[ mainIconSize , { rotate: toggle } ,'material-icons main']">{{mainIcon}}</i> |
| 40 | + <i :class="[ mainIconSize , { rotate: toggle } ,'material-icons close']">add</i> |
41 | 41 | </div> |
42 | 42 | </template> |
43 | 43 | <template v-else> |
44 | 44 | <div v-ripple="rippleColor == 'light' ? 'rgba(255, 255, 255, 0.35)' : ''" @click="toggle = !toggle" |
45 | | - class="fab pointer" :style="{ 'background-color': bgColor }" |
| 45 | + class="fab pointer" :style="{ 'background-color': bgColor, 'padding': paddingAmount }" |
46 | 46 | > |
47 | | - <i class="material-icons md-36 main" :class="{ rotate: toggle }">{{mainIcon}}</i> |
48 | | - <i class="material-icons md-36 close" :class="{ rotate: toggle }">add</i> |
| 47 | + <i :class="[ mainIconSize , { rotate: toggle }, 'material-icons main']">{{mainIcon}}</i> |
| 48 | + <i :class="[ mainIconSize , { rotate: toggle }, 'material-icons close']">add</i> |
49 | 49 | </div> |
50 | 50 | </template> |
51 | 51 | </template> |
52 | 52 | <template v-else> |
53 | 53 | <template v-if="mainTooltip"> |
54 | | - <div v-tooltip="{ content: mainTooltip, placement: tooltipPosition }" |
55 | | - class="fab pointer" :style="{ 'background-color': bgColor }" |
| 54 | + <div v-bind:v-tooltip="{ content: mainTooltip, placement: tooltipPosition, classes: 'fab-tooltip'}" |
| 55 | + class="fab pointer" :style="{ 'background-color': bgColor, 'padding': paddingAmount }" |
56 | 56 | > |
57 | 57 | <i class="material-icons md-36 main" :class="{ rotate: toggle }">{{mainIcon}}</i> |
58 | 58 | <i class="material-icons md-36 close" :class="{ rotate: toggle }">add</i> |
59 | 59 | </div> |
60 | 60 | </template> |
61 | 61 | <template v-else> |
62 | | - <div class="fab pointer" :style="{ 'background-color': bgColor }" |
| 62 | + <div class="fab pointer" :style="{ 'background-color': bgColor, 'padding': paddingAmount }" |
63 | 63 | > |
64 | 64 | <i class="material-icons md-36 main" :class="{ rotate: toggle }">{{mainIcon}}</i> |
65 | 65 | <i class="material-icons md-36 close" :class="{ rotate: toggle }">add</i> |
|
91 | 91 | position: { |
92 | 92 | default: 'bottom-right', |
93 | 93 | }, |
| 94 | + positionType: { |
| 95 | + default: 'fixed', |
| 96 | + }, |
94 | 97 | zIndex: { |
95 | 98 | default: '999', |
96 | 99 | }, |
|
103 | 106 | mainIcon: { |
104 | 107 | default: 'add' |
105 | 108 | }, |
| 109 | + iconSize: { |
| 110 | + default: 'medium' |
| 111 | + }, |
106 | 112 | mainTooltip: { |
107 | 113 | default: null |
108 | 114 | }, |
109 | 115 | actions: {} |
110 | 116 | }, |
111 | 117 | computed: { |
| 118 | + actionIconSize() { |
| 119 | + switch (this.iconSize) { |
| 120 | + case 'small': |
| 121 | + return 'md-18'; |
| 122 | + break; |
| 123 | + case 'medium': |
| 124 | + return 'md-24'; |
| 125 | + break; |
| 126 | + case 'large': |
| 127 | + return 'md-36'; |
| 128 | + break; |
| 129 | + default: |
| 130 | + return 'md-24'; |
| 131 | + } |
| 132 | + }, |
| 133 | + mainIconSize() { |
| 134 | + switch (this.iconSize) { |
| 135 | + case 'small': |
| 136 | + return 'md-24'; |
| 137 | + break; |
| 138 | + case 'medium': |
| 139 | + return 'md-36'; |
| 140 | + break; |
| 141 | + case 'large': |
| 142 | + return 'md-48'; |
| 143 | + break; |
| 144 | + default: |
| 145 | + return 'md-36'; |
| 146 | + } |
| 147 | + }, |
| 148 | + paddingAmount() { |
| 149 | + switch (this.iconSize) { |
| 150 | + case 'small': |
| 151 | + return '28px'; |
| 152 | + break; |
| 153 | + case 'medium': |
| 154 | + return '32px'; |
| 155 | + break; |
| 156 | + case 'large': |
| 157 | + return '38px'; |
| 158 | + break; |
| 159 | + default: |
| 160 | + return '32px'; |
| 161 | + } |
| 162 | + }, |
112 | 163 | listPos() { |
113 | 164 | if (this.position === 'top-right' || this.position === 'top-left') { |
114 | 165 | return { |
|
218 | 269 | </script> |
219 | 270 |
|
220 | 271 | <style> |
221 | | - .tooltip { |
| 272 | + .fab-tooltip.tooltip { |
222 | 273 | display: block !important; |
223 | | - padding: .5rem 1rem; |
| 274 | + padding: 4px; |
224 | 275 | z-index: 10000; |
225 | 276 | } |
226 | 277 |
|
227 | | - .tooltip .tooltip-inner { |
| 278 | + .fab-tooltip.tooltip .tooltip-inner { |
228 | 279 | background: #333333; |
229 | | - font-size: .85rem; |
230 | 280 | color: white; |
231 | | - padding: .2rem 1rem; |
| 281 | + border-radius: 0px; |
| 282 | + padding: 5px 10px 4px; |
232 | 283 | } |
233 | 284 |
|
234 | | - .tooltip .tooltip-arrow{ |
| 285 | + .fab-tooltip.tooltip tooltip-arrow{ |
235 | 286 | display: none; |
236 | 287 | } |
237 | 288 |
|
238 | | - .tooltip[aria-hidden='true'] { |
| 289 | + .fab-tooltip.tooltip[aria-hidden='true'] { |
239 | 290 | visibility: hidden; |
240 | 291 | opacity: 0; |
241 | 292 | transition: opacity .15s, visibility .15s; |
242 | 293 | } |
243 | 294 |
|
244 | | - .tooltip[aria-hidden='false'] { |
| 295 | + .fab-tooltip.tooltip[aria-hidden='false'] { |
245 | 296 | visibility: visible; |
246 | 297 | opacity: 1; |
247 | 298 | transition: opacity .15s; |
|
255 | 306 | } |
256 | 307 |
|
257 | 308 | .fab-wrapper { |
258 | | - position: fixed; |
259 | 309 | z-index: 999; |
260 | 310 | } |
261 | 311 |
|
262 | 312 | .fab { |
263 | 313 | border-radius: 100px; |
264 | | - width: 65px; |
| 314 | + /*width: 65px;*/ |
| 315 | + /*height: 65px;*/ |
| 316 | + padding: 30px; |
265 | 317 | position: relative; |
266 | 318 | overflow: hidden; |
267 | | - height: 65px; |
268 | 319 | display: flex; |
269 | 320 | align-items: center; |
270 | 321 | box-shadow: 0 10px 10px rgba(0, 0, 0, 0.20), 0 4px 4px rgba(0, 0, 0, 0.15); |
271 | 322 | z-index: 2; |
272 | | - display: flex; |
273 | | - align-items: center; |
274 | 323 | justify-content: center; |
275 | 324 | } |
276 | 325 |
|
|
313 | 362 | .fab-list { |
314 | 363 | position: relative; |
315 | 364 | z-index: 1; |
316 | | - margin: 2vh 0.5vw; |
| 365 | + margin: 2vh 0; |
| 366 | + display: flex; |
| 367 | + flex-direction: column; |
| 368 | + align-items: center; |
317 | 369 | } |
318 | 370 |
|
319 | 371 | .fab-list li { |
320 | | - width: 50px; |
321 | | - height: 50px; |
| 372 | + /*width: 50px;*/ |
| 373 | + /*height: 50px;*/ |
| 374 | + padding: 10px; |
322 | 375 | margin-top: 2vh; |
323 | 376 | display: flex; |
324 | 377 | align-items: center; |
|
383 | 436 |
|
384 | 437 | @media screen and (max-width: 768px) { |
385 | 438 | .fab-list { |
386 | | - margin: 2vh 1.8vw; |
| 439 | + margin: 2vh 0; |
387 | 440 | } |
388 | 441 |
|
389 | 442 | .fab-list li { |
390 | | - width: 40px; |
391 | | - height: 40px; |
| 443 | + /*width: 40px;*/ |
| 444 | + /*height: 40px;*/ |
| 445 | + /*padding: .6rem;*/ |
392 | 446 | } |
393 | 447 |
|
394 | 448 | .fab-list li i { |
395 | | - font-size: 24px !important; |
| 449 | + /*font-size: 24px !important;*/ |
396 | 450 | } |
397 | 451 |
|
398 | 452 | .fab { |
399 | | - width: 55px; |
400 | | - height: 55px; |
| 453 | + /*width: 55px;*/ |
| 454 | + /*height: 55px;*/ |
| 455 | + /*padding: 1.5rem;*/ |
401 | 456 | } |
402 | 457 |
|
403 | 458 | .fab i { |
404 | | - font-size: 34px !important; |
| 459 | + /*font-size: 34px !important;*/ |
405 | 460 | } |
406 | 461 |
|
407 | 462 | } |
|
0 commit comments