Skip to content

Commit

Permalink
chore: add demos
Browse files Browse the repository at this point in the history
  • Loading branch information
lingbopro committed Dec 15, 2024
1 parent 219aeed commit f865724
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 0 deletions.
27 changes: 27 additions & 0 deletions demos/assets/css/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
html,
body,
#root,
mm-page {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
}
main {
padding: 20px;
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 3px inherit;
}
section {
margin: 5px 0;
padding: 20px;
border-radius: 6px;
box-sizing: border-box;
border: rgb(var(--mm-color-outline-variant)) solid 1px;
}
56 changes: 56 additions & 0 deletions demos/components/ripple.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Ripple · Material-Me Component Demo</title>
<link rel="stylesheet" href="../assets/css/index.css" />
<style>
#ripple-1,
#ripple-2,
#ripple-3,
#ripple-4,
#ripple-5-container {
padding: 10px;
}
#ripple-2 {
color: #ffa8ec;
}
#ripple-3 {
--mm-ripple-color: lightblue;
}
#ripple-4 {
display: block;
}
#ripple-5-container {
display: block;
position: relative;
}
</style>
<script type="module">
import '../../dist/components/page.js';
import '../../dist/components/ripple.js';
</script>
</head>
<body>
<mm-page id="root" theme="auto">
<main>
<h1>Ripple</h1>
<section>
<mm-ripple id="ripple-1"> Simple Ripple </mm-ripple>
<mm-ripple id="ripple-2"> Ripple with text color </mm-ripple>
<mm-ripple id="ripple-3"> Ripple with specified color </mm-ripple>
</section>
<section>
<mm-ripple id="ripple-4"> Full line Ripple </mm-ripple>
</section>
<section>
<div id="ripple-5-container">
Attached Ripple
<mm-ripple id="ripple-5" attached></mm-ripple>
</div>
</section>
</main>
</mm-page>
</body>
</html>
19 changes: 19 additions & 0 deletions demos/esm.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Material-Me ESM Importing Demo</title>
</head>
<body>
<div id="root">see console output.</div>
<script type="module">
async function main() {
const materialMe = await import('../dist/main.js');
window.materialMe = materialMe;
console.log('ESM Imported Module: ', materialMe);
}
main();
</script>
</body>
</html>
50 changes: 50 additions & 0 deletions demos/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Material-Me Demo</title>
<link rel="stylesheet" href="./assets/css/index.css" />
<style>
a:link,
a:hover,
a:active,
a:visited {
color: var(--mm-color-primary);
}
.links mm-ripple {
display: block;
}
.links a {
display: block;
padding: 10px;
text-decoration: none;
font-size: large;
}
.links h2 {
font-size: larger;
margin-top: 0;
}
</style>
<script type="module">
import '../../dist/components/page.js';
import '../../dist/components/ripple.js';
</script>
</head>
<body>
<mm-page theme="auto">
<main>
<h1>Material-Me Demo</h1>
<section class="links">
<h2>Components</h2>
<mm-ripple><a href="./components/ripple.html">Ripple</a></mm-ripple>
</section>
<section class="links">
<h2>Others</h2>
<mm-ripple><a href="./esm.html">ESM Importing</a></mm-ripple>
</section>
</main>
</mm-page>
<script defer src="../dist/material-me.min.js"></script>
</body>
</html>

0 comments on commit f865724

Please sign in to comment.