Permalink
Browse files

🍣 attributeでカスタムタグに値を渡すよう修正

  • Loading branch information...
1 parent e8ba438 commit 0568aa0318b8522fd60399bf534079220f1cf6ee @tumbling-dice committed Sep 10, 2016
Showing with 33 additions and 37 deletions.
  1. +11 −19 public/blog.html
  2. +22 −0 public/components/blog.tag
  3. +0 −18 public/stylesheets/blog.css
View
@@ -32,13 +32,9 @@ <h1 class="blog-title">The Bootstrap Blog</h1>
</div>
<div class="row">
-
<div class="col-sm-8 blog-main">
- <div class="blog-post">
- <h2 class="blog-post-title">Sample blog post</h2>
- <p class="blog-post-meta">January 1, 2014 by <a href="#">Mark</a></p>
-
+ <blog-post title="Sample blog post" meta="January 1, 2014" author="Mark" link="#">
<p>This blog post shows a few different types of content that's supported and styled with Bootstrap. Basic typography, images, and code are all supported.</p>
<hr>
<p>Cum sociis natoque penatibus et magnis <a href="#">dis parturient montes</a>, nascetur ridiculus mus. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Sed posuere consectetur est at lobortis. Cras mattis consectetur purus sit amet fermentum.</p>
@@ -66,26 +62,18 @@ <h2 class="blog-post-title">Sample blog post</h2>
<li>Maecenas sed diam eget risus varius blandit sit amet non magna.</li>
</ol>
<p>Cras mattis consectetur purus sit amet fermentum. Sed posuere consectetur est at lobortis.</p>
- </div>
- <!-- /.blog-post -->
-
- <div class="blog-post">
- <h2 class="blog-post-title">Another blog post</h2>
- <p class="blog-post-meta">December 23, 2013 by <a href="#">Jacob</a></p>
+ </blog-post>
+ <blog-post title="Another blog post" meta="December 23, 2013" author="Jacob" link="#">
<p>Cum sociis natoque penatibus et magnis <a href="#">dis parturient montes</a>, nascetur ridiculus mus. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Sed posuere consectetur est at lobortis. Cras mattis consectetur purus sit amet fermentum.</p>
<blockquote>
<p>Curabitur blandit tempus porttitor. <strong>Nullam quis risus eget urna mollis</strong> ornare vel eu leo. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</blockquote>
<p>Etiam porta <em>sem malesuada magna</em> mollis euismod. Cras mattis consectetur purus sit amet fermentum. Aenean lacinia bibendum nulla sed consectetur.</p>
<p>Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p>
- </div>
- <!-- /.blog-post -->
-
- <div class="blog-post">
- <h2 class="blog-post-title">New feature</h2>
- <p class="blog-post-meta">December 14, 2013 by <a href="#">Chris</a></p>
+ </blog-post>
+ <blog-post title="New feature" meta="December 14, 2013" author="Chris" link="#">
<p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna mollis euismod. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
<ul>
<li>Praesent commodo cursus magna, vel scelerisque nisl consectetur et.</li>
@@ -94,8 +82,7 @@ <h2 class="blog-post-title">New feature</h2>
</ul>
<p>Etiam porta <em>sem malesuada magna</em> mollis euismod. Cras mattis consectetur purus sit amet fermentum. Aenean lacinia bibendum nulla sed consectetur.</p>
<p>Donec ullamcorper nulla non metus auctor fringilla. Nulla vitae elit libero, a pharetra augue.</p>
- </div>
- <!-- /.blog-post -->
+ </blog-post>
<nav>
<ul class="pager">
@@ -155,6 +142,11 @@ <h2 class="blog-post-title">New feature</h2>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="./javascripts/bootstrap.min.js"></script>
+ <script type="text/javascript" src="./javascripts/riot+compiler.min.js"></script>
+ <script type="riot/tag" src="./components/blog.tag"></script>
+ <script>
+ riot.mount('*');
+ </script>
</body>
</html>
@@ -0,0 +1,22 @@
+<blog-post>
+ <div class="blog-post">
+ <h2 class="blog-post-title">{ opts.title }</h2>
+ <p class="blog-post-meta">{ opts.meta } by <a href="{ opts.link }">{ opts.author }</a></p>
+ <yield/>
+ </div>
+
+ <style scoped>
+ .blog-post {
+ margin-bottom: 60px;
+ }
+ .blog-post-title {
+ margin-bottom: 5px;
+ font-size: 40px;
+ }
+ .blog-post-meta {
+ margin-bottom: 20px;
+ color: #999;
+ }
+
+ </style>
+</blog-post>
@@ -132,24 +132,6 @@ h6, .h6 {
border-radius: 30px;
}
-
-/*
- * Blog posts
- */
-
-.blog-post {
- margin-bottom: 60px;
-}
-.blog-post-title {
- margin-bottom: 5px;
- font-size: 40px;
-}
-.blog-post-meta {
- margin-bottom: 20px;
- color: #999;
-}
-
-
/*
* Footer
*/

0 comments on commit 0568aa0

Please sign in to comment.