-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
243 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
Copyright 2016 Google Inc. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License | ||
--> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>MDL FAB Demo</title> | ||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> | ||
<style> | ||
/* Make the demo look a little bit better */ | ||
fieldset { | ||
margin-bottom: 0.5rem; | ||
} | ||
|
||
fieldset .mdl-fab { | ||
margin: 16px; | ||
} | ||
|
||
.app-fab--absolute.app-fab--absolute { | ||
position: absolute; | ||
bottom: 1rem; | ||
right: 1rem; | ||
} | ||
|
||
@media(min-width: 1024px) { | ||
.app-fab--absolute.app-fab--absolute { | ||
bottom: 3rem; | ||
right: 5rem; | ||
} | ||
} | ||
</style> | ||
<script src="assets/material-design-lite.css.js" charset="utf-8"></script> | ||
</head> | ||
<body> | ||
<main> | ||
<h1>MDL FAB</h1> | ||
|
||
<button class="mdl-fab material-icons app-fab--absolute"> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> | ||
<path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"/> | ||
</svg> | ||
</button> | ||
|
||
<section> | ||
<fieldset> | ||
<legend>Normal FABs</legend> | ||
<button class="mdl-fab material-icons"> | ||
favorite_border | ||
</button> | ||
<button class="mdl-fab mdl-fab--mini material-icons"> | ||
favorite_border | ||
</button> | ||
<button class="mdl-fab mdl-fab--plain material-icons"> | ||
favorite_border | ||
</button> | ||
<button class="mdl-fab mdl-fab--mini mdl-fab--plain material-icons"> | ||
favorite_border | ||
</button> | ||
</fieldset> | ||
<fieldset disabled> | ||
<legend>Disabled FABs</legend> | ||
<button class="mdl-fab material-icons"> | ||
favorite_border | ||
</button> | ||
<button class="mdl-fab mdl-fab--mini material-icons"> | ||
favorite_border | ||
</button> | ||
<button class="mdl-fab mdl-fab--plain material-icons"> | ||
favorite_border | ||
</button> | ||
<button class="mdl-fab mdl-fab--mini mdl-fab--plain material-icons"> | ||
favorite_border | ||
</button> | ||
</fieldset> | ||
</section> | ||
</main> | ||
<script src="assets/material-design-lite.js" charset="utf-8"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Copyright 2016 Google Inc. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* @TODO Remove the shadow stuff here once https://github.com/google/material-design-lite/issues/4592 is done. */ | ||
$mdl-shadow-key-umbra-opacity: .2; | ||
$mdl-shadow-key-penumbra-opacity: .14; | ||
$mdl-shadow-ambient-shadow-opacity: .12; | ||
|
||
@mixin mdl-focus-shadow() { | ||
box-shadow: 0 0 8px rgba(0, 0, 0, .18), 0 8px 16px rgba(0, 0, 0, .36); | ||
} | ||
|
||
@mixin mdl-shadow-4dp() { | ||
box-shadow: | ||
0 2px 4px -1px rgba(0, 0, 0, $mdl-shadow-key-umbra-opacity), | ||
0 4px 5px 0 rgba(0, 0, 0, $mdl-shadow-key-penumbra-opacity), | ||
0 1px 10px 0 rgba(0, 0, 0, $mdl-shadow-ambient-shadow-opacity); | ||
} | ||
|
||
/* @TODO Remove this internally once the theme base is in place. */ | ||
:root { | ||
--mdl-theme-color-accent: rgb(255, 64, 129); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
/** | ||
* Copyright 2016 Google Inc. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
@import "variables"; | ||
|
||
.mdl-fab { | ||
@include mdl-shadow-4dp; | ||
display: inline-flex; | ||
position: relative; | ||
justify-content: center; | ||
width: 56px; | ||
height: 56px; | ||
padding: 0; | ||
transition: box-shadow 280ms cubic-bezier(.4, 0, .2, 1); | ||
border: none; | ||
border-radius: 50%; | ||
background-color: var(--mdl-theme-color-accent); | ||
color: white; | ||
cursor: pointer; | ||
overflow: hidden; | ||
user-select: none; | ||
box-sizing: border-box; | ||
fill: currentColor; | ||
-webkit-appearance: none; | ||
|
||
&--mini { | ||
width: 40px; | ||
height: 40px; | ||
} | ||
|
||
&--plain { | ||
background-color: white; | ||
color: rgba(0, 0, 0, .87); | ||
} | ||
|
||
&::before, | ||
&::after { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
transition: opacity 120ms cubic-bezier(0, 0, .2, 1); | ||
border-radius: inherit; | ||
content: ""; | ||
} | ||
|
||
&::before { | ||
background: black; | ||
opacity: 0; | ||
} | ||
|
||
&:focus::before { | ||
opacity: .12; | ||
} | ||
|
||
&::after { | ||
width: 100%; | ||
height: 100%; | ||
background: black; | ||
opacity: 0; | ||
overflow: hidden; | ||
} | ||
|
||
&:active::after { | ||
opacity: .06; | ||
} | ||
|
||
&:active, | ||
&:focus { | ||
outline: none; | ||
} | ||
|
||
&:active { | ||
@include mdl-focus-shadow; | ||
} | ||
|
||
&:hover { | ||
cursor: pointer; | ||
} | ||
|
||
&::-moz-focus-inner { | ||
padding: 0; | ||
border: 0; | ||
} | ||
|
||
/* stylelint-disable selector-no-type */ | ||
fieldset:disabled &, | ||
&:disabled { | ||
background-color: rgba(0, 0, 0, .12); | ||
color: rgba(0, 0, 0, .26); | ||
cursor: default; | ||
pointer-events: none; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "mdl-fab", | ||
"description": "A simple FAB component provided by Material Design Lite", | ||
"version": "1.0.0", | ||
"license": "Apache-2.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters