diff --git a/client/assets/scss/Sidebar.scss b/client/assets/scss/Sidebar.scss new file mode 100644 index 0000000..88ad3f3 --- /dev/null +++ b/client/assets/scss/Sidebar.scss @@ -0,0 +1,64 @@ +$transitionDuration: .4s; + +.Sidebar{ + background: #fff; + width: 300px; + padding-right: 1em; + padding-left: 1em; + + img{ + width: 100%; + height: auto; + } + + a.toggler{ + display: none; + } + + @media (max-width: 768px) { + position: absolute; + top: 0; + right: 0; + min-height: 100%; + + transform: translateX(300px); + -webkit-transform: translateX(300px); + transition: transform $transitionDuration ease-out; + -webkit-transition: transform $transitionDuration ease-out; + + &.open { + transform: translateX(0px); + -webkit-transform: translateX(0px); + border-left: 1px solid #EAEAEA; + + &:before { + content: " "; + display: block; + background: rgba(0,0,0,0.4); + position: absolute; + height: 100%; + width: 100vw; + top: 0; + right: 100%; + } + + a.toggler{ + transform: rotate(450deg); + } + } + + a.toggler{ + display: block; + width: 2em; + height: 2em; + position: absolute; + left: -3em; + top: .5em; + cursor: pointer; + color: white; + transform: rotate(0deg); + transition: transform $transitionDuration ease-out; + -webkit-transition: transform $transitionDuration ease-out; + } + } +} \ No newline at end of file diff --git a/client/assets/scss/main.scss b/client/assets/scss/main.scss index f92c289..c8c81e8 100644 --- a/client/assets/scss/main.scss +++ b/client/assets/scss/main.scss @@ -1,5 +1,26 @@ +@import './utils.scss'; + body{ position: relative; + -webkit-font-smoothing: subpixel-antialiased; +} + +*, +*:before, +*:after { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +a{ + background-color: transparent; + color: #3598db; + text-decoration: none; + + &:hover{ + color: #3598db; + } } .Layout { @@ -46,22 +67,4 @@ body{ .Previews{ flex: 1; -webkit-flex: 1; -} - -.Sidebar{ - background: #fff; - width: 300px; - - img{ - width: 100%; - height: auto; - } - - @media (max-width: 768px) { - position: absolute; - top: 0; - bottom: 0; - right: 0; - } -} - +} \ No newline at end of file diff --git a/client/assets/scss/utils.scss b/client/assets/scss/utils.scss new file mode 100644 index 0000000..f9acf7e --- /dev/null +++ b/client/assets/scss/utils.scss @@ -0,0 +1,25 @@ +/* Effect 1: Brackets */ +.link{ + position: relative; + + &:before{ + content: ""; + position: absolute; + width: 100%; + height: 1px; + bottom: 0; + left: 0; + background-color: #3598db; + visibility: hidden; + -webkit-transform: scaleX(0); + transform: scaleX(0); + -webkit-transition: all 0.2s ease-in-out 0s; + transition: all 0.2s ease-in-out 0s; + } + + &:hover:before{ + visibility: visible; + -webkit-transform: scaleX(1); + transform: scaleX(1); + } +} \ No newline at end of file diff --git a/client/js/app.js b/client/js/app.js index ac75525..dfd8da4 100644 --- a/client/js/app.js +++ b/client/js/app.js @@ -40,7 +40,7 @@ ReactDOM.render(( - + diff --git a/client/js/components/Post.js b/client/js/components/Post.js new file mode 100644 index 0000000..fe6fec3 --- /dev/null +++ b/client/js/components/Post.js @@ -0,0 +1,11 @@ +import React from 'react'; + +export default class Post extends React.Component{ + + + render(){ + return( +
+ ); + } +} \ No newline at end of file diff --git a/client/js/components/Preview.js b/client/js/components/Preview.js index d27928d..90295c1 100644 --- a/client/js/components/Preview.js +++ b/client/js/components/Preview.js @@ -8,9 +8,9 @@ export default class Preview extends React.Component{ for (let i in posts){ elements.push(
-

{posts[i].title}

{posts[i].date}

-

{posts[i].intro}

+

+

); } @@ -18,6 +18,12 @@ export default class Preview extends React.Component{ return elements; } + decodeHtml(html) { + var txt = document.createElement("textarea"); + txt.innerHTML = html; + return {__html : txt.value}; + } + render(){ const posts = this.props.posts; diff --git a/client/js/components/Sidebar.js b/client/js/components/Sidebar.js index 6f79030..6834ce6 100644 --- a/client/js/components/Sidebar.js +++ b/client/js/components/Sidebar.js @@ -1,14 +1,35 @@ import React from 'react'; -//images +//assest import me from '../../assets/images/me.jpg'; +import '../../assets/scss/Sidebar.scss'; export default class Sidebar extends React.Component{ + constructor(){ + super(); + + this.state = { + toggler: "" + }; + + this.onToggle = this.onToggle.bind(this); + } + + onToggle(){ + let temp = this.state.toggler; + temp = temp === "open" ? "" : "open"; + + this.setState({ + toggler: temp + }); + } + render(){ return( -