HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URL's added here will be added as <link>
s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
If the stylesheet you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
#app
//- .bg
//- .main-bg-texture
//- nav.main-nav
//- .nav-content
//- img.logo-img(src="https://zephyo.github.io/treehacks/graphics/icon.png")
//- span.logo my_friends
//- span.sublogo give and get support.
//- button#feed-but
//- span(data-jam="messages-alt" data-fill="#9FC6C1")
//- button#network-but
//- span(data-jam="users" data-fill="#9FC6C1")
//- button#user-but
//- span(data-jam="user" data-fill="#9FC6C1")
//- section.feed.active-section
//- .create-thought
//- textarea(rows="2" placeholder="Your thoughts")
//- button#update update
//- h1.date-marker February 15
//- .checkin.activity
//- .header
//- .pic
//- span.name Gloria Wang
//- span.sub checked in
//- span.date A few seconds ago
//- button.user-edit
//- span(data-jam="pencil" data-fill="#EFF0DA")
//- .content
//- .mood
//- span feeling
//- .mood-icon 5
//- span feeling better but still kinda sad because I don't know anyone in my dorm :/ is that just me?
//- .mood
//- span took meds
//- .mood-icon
//- span(data-jam="check" data-fill="#EFF0DA")
//- .leave-comment
//- input(type="text" placeholder="comment..")
//- button
//- span(data-jam="paper-plane" data-fill="#9FC6C1")
//- .thought.activity
//- .header
//- .pic
//- span.name Brianna Burman
//- span.sub updated
//- span.date 12 min ago
//- .reply
//- span worried/stressed abt interviews
//- .comment
//- span you got this!!
//- .comment
//- span So awesome you’re planning for them! Since you’re thinking about it, I’m sure you’ll be super prepared!
//- .reply
//- span thx guys :) i appreicate it
//- .leave-comment
//- input(type="text" placeholder="comment..")
//- button
//- span(data-jam="paper-plane" data-fill="#9FC6C1")
//- section.network
//- .header
//- .search-bar
//- input(type="text" placeholder="search")
//- button#search-friends
//- span(data-jam="search" data-fill="#9FC6C1")
//- button#add-friends
//- span(data-jam="user-plus" data-fill="#9FC6C1")
//- .friends
//- .friend
//- .pic
//- span Brianna Burman
//- button
//- span(data-jam="heart" data-fill="#e38882")
//- .friend
//- .pic
//- span Felicia Wilson
//- button
//- span(data-jam="heart" data-fill="#e38882")
//- section.user
//- button#edit
//- span(data-jam="pencil" data-fill="#9FC6C1")
//- .pic
//- h1 Gloria Wang
//- span.username @gloria1029
//- .check-in-edit
//- h2 Your Daily Check-in
//- ul
//- li How are you feeling today?
//- li Did you take your medication?
//- button add more
//- button#logout-but logout
//- .modal-bg
//- .checkin.modal
//- img.bg-texture.first(src="https://zephyo.github.io/treehacks/graphics/flower.png")
//- img.bg-texture.second(src="https://zephyo.github.io/treehacks/graphics/thing.png")
//- .bg
//- h1 February 15
//- h1.title
//- .highlight
//- span check-in
//- h2 How are you feeling today?
//- .mood-measurer
//- input(type="range" min="1" max="7" value="4")
//- .indicator
//- p 4
//- .num
//- small 1
//- small 7
//- .feelings(contenteditable="true") How am I feeling? ..
//- h2 Did you take your medication?
//- .yesno
//- button.yes
//- span(data-jam="check" data-fill="white")
//- button.no
//- span(data-jam="close" data-fill="#8A8184")
//- button#submit
//- span(data-jam="check" data-fill="#9FC6C1")
//- .home-page
//- img.bg-texture(src="https://zephyo.github.io/treehacks/graphics/hero.gif")
//- img(src="https://zephyo.github.io/treehacks/graphics/plants.png")
//- h2 my_friends
//- p give and get support from your support network. feel safe with the ones you trust.
//- .buts
//- button#signup-but sign up
//- button#login-but login
@import url("https://fonts.googleapis.com/css?family=Frank+Ruhl+Libre");
@import url("https://fonts.googleapis.com/css?family=Rubik:300, 700");
$light: #eff0da;
$lighter-pink: #f4deda;
$light-pink: #f1d0ca;
$pink: #e38882;
$green: #9fc6c1;
$dark-green: #899c7d;
$dark: #8a8184;
$black: #635358;
$feed-padding: 20px;
$nav-height: 52px;
@mixin absolute {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
* {
box-sizing: border-box;
}
body {
background: rgba($pink, 0.5);
@include absolute;
padding: 0;
margin: 0;
font-family: "Rubik", sans-serif;
font-weight: 300;
color: $black;
}
h1 {
font-family: "Frank Ruhl Libre", serif;
text-transform: uppercase;
color: $dark;
}
.jam {
font-size: 1.5rem;
}
button {
border: none;
height: 70px;
width: 70px;
font-family: inherit;
font-size: inherit;
transition: all 0.3s ease;
&:hover {
background: $light-pink;
}
}
input[type="text"],
input[type="email"],
input[type="password"],
textarea {
font-family: inherit;
font-size: inherit;
border: none;
}
.container {
@include absolute;
}
.bg {
@include absolute;
background: $light-pink;
z-index: -2;
}
.main-bg-texture {
position: absolute;
mix-blend-mode: multiply;
z-index: -1;
top: 50px;
height: 185px;
width: 100%;
opacity: 0.6;
background-size: contain;
background-image: url("https://zephyo.github.io/Newroots/static/pattern.png");
}
.main-nav {
z-index: 2;
background: $light-pink;
position: fixed;
height: $nav-height;
width: 100%;
box-shadow: 0 0 30px rgba($pink, 0.3);
.nav-content {
height: inherit;
display: flex;
justify-content: flex-end;
align-items: center;
max-width: 800px;
margin: auto;
button {
flex: auto;
border: none;
height: inherit;
border-radius: 0;
}
.logo-img {
height: 70%;
margin: 10px;
}
.logo {
margin-right: auto;
color: $dark;
font-weight: 700;
.sublogo {
margin-left: 15px;
margin-right: 50px;
font-size: 0.8rem;
font-weight: 300;
}
}
}
}
section {
margin: auto;
margin-top: $nav-height*1.5;
max-width: 800px;
}
.pic {
background: $dark;
height: 45px;
width: 45px;
border-radius: 50%;
background-image: url("https://zephyo.github.io/treehacks/graphics/ppf.png");
background-size: cover;
}
.feed {
padding: 0 $feed-padding 0 $feed-padding;
}
.create-thought {
position: relative;
display: flex;
flex-direction: column;
textarea {
width: 100%;
padding: $feed-padding;
margin-bottom: $feed-padding/1.5;
border-radius: 2rem;
resize: none;
}
#update {
align-self: flex-end;
background: $dark-green;
color: white;
padding: $feed-padding;
width: 7rem;
border-radius: 2rem;
margin-right: $feed-padding;
}
&:before,
&:after {
content: "";
background: white;
border-radius: 50%;
position: absolute;
bottom: 75px;
left: -5px;
width: 25px;
height: 25px;
}
&:after {
bottom: 60px;
left: -20px;
width: 13px;
height: 13px;
}
}
.activity {
margin: $feed-padding*2;
box-shadow: 0 8px 30px rgba($dark, 0.2);
.header {
padding: $feed-padding;
display: flex;
align-items: center;
.name {
margin-left: 20px;
font-weight: 700;
}
.date {
margin-left: auto;
}
}
.content {
padding: $feed-padding;
padding-top: 0;
}
.mood {
font-size: 1.5rem;
display: flex;
justify-content: center;
align-items: center;
margin: $feed-padding;
margin-top: 0;
}
.mood-icon {
display: inline-block;
background: $green;
border: 2px solid white;
border-radius: 50%;
width: 50px;
height: 50px;
text-align: center;
line-height: 50px;
margin-left: 1rem;
}
}
.user-edit {
width: 50px;
height: 50px;
background: transparent;
margin-left: $feed-padding;
}
.thought {
display: flex;
flex-direction: column;
.header,
.comment,
.reply {
background: $light;
}
.comment,
.reply {
padding: $feed-padding;
margin: $feed-padding/3;
display: inline-block;
max-width: 70%;
}
.comment {
text-align: right;
align-self: flex-end;
border-radius: 3rem 3rem 0 3rem;
background: $dark-green;
color: $light;
}
.reply {
align-self: flex-start;
border-radius: 0 3rem 3rem 3rem;
}
}
.leave-comment {
background: white;
display: flex;
input {
flex: auto;
padding-left: $feed-padding;
}
button {
height: $feed-padding*3.5;
border: none;
border-radius: 0;
}
}
.network {
display: flex;
flex-direction: column;
.header {
display: flex;
justify-content: space-between;
.search-bar {
flex: auto;
display: flex;
margin-right: 10px;
input {
flex: auto;
padding: $feed-padding;
}
}
margin-bottom: $feed-padding;
}
.friend {
background: rgba($lighter-pink, 0.6);
display: flex;
align-items: center;
padding-left: $feed-padding;
margin-bottom: $feed-padding/2;
button {
background: transparent;
margin-left: auto;
}
span {
margin-left: $feed-padding;
}
}
}
.user {
display: flex;
flex-direction: column;
align-items: center;
#edit {
align-self: flex-end;
border-radius: 50%;
margin-right: $feed-padding;
}
.pic {
width: 100px;
height: 100px;
}
.check-in-edit {
margin: $feed-padding;
align-self: stretch;
background: $light-pink;
text-align: center;
box-shadow: 0 3px 15px rgba($pink, 0.4);
ul {
list-style: none;
padding: 0;
li {
padding: $feed-padding;
box-shadow: 0 3px 10px rgba($pink, 0.4);
}
}
button {
width: 100%;
background: $dark-green;
color: white;
}
}
#logout-but {
margin-top: $feed-padding;
background: $pink;
width: 100%;
}
}
.checkin {
background: $pink;
color: white;
&.modal {
padding: $feed-padding*2;
background: $light;
.bg {
background: $pink;
@include absolute;
z-index: 0;
}
> *:not(h1) {
margin: $feed-padding;
}
> *:not(h1):not(.bg):not(.bg-texture) {
position: relative;
}
h1 {
position: absolute;
top: -6rem;
&.title {
top: -4rem;
}
.highlight {
position: absolute;
z-index: 0;
top: 2rem;
bottom: 0;
left: -0.5rem;
right: -0.5rem;
background: linear-gradient(to top, white, $light);
}
span {
z-index: 1;
position: relative;
}
}
#submit {
border-radius: 50%;
border: 3px solid $green;
margin: 40px;
}
}
}
.feelings {
width: 100%;
height: 100px;
color: $dark;
margin: 0 auto;
padding: 20px;
background: #fcfcfc;
box-shadow: inset 0 0 8px 1px rgba(0, 0, 0, 0.2);
text-align: left;
overflow: hidden;
word-break: break-all;
outline: none;
}
@mixin sliderThumb() {
&::-webkit-slider-thumb {
@content;
}
&::-moz-range-thumb {
@content;
}
&::-ms-thumb {
@content;
}
}
@mixin sliderTrack() {
&::-webkit-slider-runnable-track {
@content;
}
&::-moz-range-track {
@content;
}
&::-ms-track {
@content;
}
}
.mood-measurer {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: stretch;
width: 100%;
position: relative;
.indicator {
position: absolute;
left: 92%;
top: -70px;
padding: 0px 20px 0px 20px;
background: $light;
color: $pink;
font-weight: 600;
box-shadow: 0 3px 20px rgba($dark, 0.4);
&:before {
content: "";
position: absolute;
background: $light;
width: 15px;
height: 15px;
bottom: -7px;
left: 0;
right: 0;
margin: auto;
transform: rotate(45deg);
}
}
.num {
display: inline-flex;
justify-content: inherit;
margin: 15px 26px 0 26px;
}
small {
color: white;
}
input {
appearance: none;
outline: none;
border-radius: 0.25rem;
position: relative;
@include sliderThumb {
position: relative;
width: 3.5rem;
height: 3.5rem;
cursor: pointer;
background-color: $green;
border: 0.2em solid white;
border-radius: 50%;
-webkit-appearance: none;
}
@include sliderTrack {
box-shadow: inset 0 0 0px 26px $pink;
}
}
}
.yesno {
display: flex;
width: 80%;
button {
flex: auto;
border-radius: 3rem;
margin: 0 10px 0 10px;
}
.yes {
background: $green;
}
.no {
background: $light-pink;
}
}
.modal-bg {
@include absolute;
background: rgba(white, 0.4);
}
.modal {
width: 100%;
max-width: 700px;
position: absolute;
background: $light;
left: 0;
right: 0;
top: 10rem;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-evenly;
margin: auto;
box-shadow: 0 5px 30px rgba($pink, 0.8);
.title {
font-size: 3rem;
}
.bg-texture.first {
position: absolute;
bottom: -120px;
left: -180px;
}
.bg-texture.second {
position: absolute;
right: -140px;
top: -50px;
}
}
.home-page {
background: $light;
@include absolute;
padding: $feed-padding;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: $pink;
text-align: center;
.bg-texture {
pointer-events: none;
position: absolute;
height: 80%;
top: 0;
mix-blend-mode: darken;
}
h2 {
margin-top: 4rem;
margin-bottom: 0;
font-size: 3rem;
}
p {
font-size: 1.5rem;
max-width: 500px;
}
button {
background: $dark-green;
color: $light;
border-radius: 5rem;
margin: 2rem;
margin-bottom: 0;
width: 150px;
height: 100px;
}
.buts {
display: flex;
justify-content: space-around;
flex-wrap: wrap;
}
.signup-but {
background: $pink;
}
.login-but {
background: $dark-green;
}
.login-page {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
input {
height: 20vh;
max-height: 70px;
padding: $feed-padding;
margin: $feed-padding;
}
h2 {
position: relative;
font-size: 2.5rem;
margin-bottom: $feed-padding;
}
}
.back-but {
position: absolute;
top: -15px;
left: -80px;
margin:0;
width: 80px;
height: 80px;
background: transparent;
.jam {
font-size: 2.2rem;
}
}
}
var data = {
baseURL: '',
graphicsURL: 'https://zephyo.github.io/treehacks/graphics/',
activeTab: 0,
userData: null,
feed: [
],
},
userBase='users',
config = {
apiKey: "AIzaSyBnWbqZC0wncY06pWlHX8DCbIM_EM9zrE8",
authDomain: "day-7-messaging.firebaseapp.com",
databaseURL: "https://day-7-messaging.firebaseio.com",
projectId: "day-7-messaging",
storageBucket: "day-7-messaging.appspot.com",
messagingSenderId: "307150346579"
};
firebase.initializeApp(config);
class App extends React.Component {
constructor(props) {
super(props);
this.state = data;
}
componentWillMount() {
this.setState({
firebaseRef: firebase.database().ref(userBase),
}, this.update);
}
setActiveTab = (index) => {
this.setState({
activeTab: index,
});
}
checkLogin = (user, pass) => {
//check against database
//if (user)
//if valid, set userData
this.setState({
userData:
{
profileImage: '',
name: 'Gloria Wang',
username: 'gloria',
lastCheckin: '02/14/2019',
checkin: [
{
q: 'How are you feeling today?',
type: 'range',
},
{
q: 'Have you took your medication?',
type: 'yesno'
}
],
},
});
}
// update this.state.lastCheckin as well as input checkin data to feed/database
updateCheckin = () => {
this.setState({
userData: {
...this.state.userData,
lastCheckin: moment().format('L')
}
});
}
//check this.state.lastCheckin and see whether user has checked in today
needToCheckin = () => {
if (this.state.userData.lastCheckin != moment().format('L')){
return true;
}
else{
return false;
}
}
//logout
logout = () => {
this.setState({
userData: null
});
}
render() {
if (this.state.userData === null){
return (
<HomePage
graphicsURL = {this.state.graphicsURL}
checkLogin = {this.checkLogin}
/>
);
}
var activeTab;
//active tab is feed
if (this.state.activeTab == 0){
activeTab = (
<FeedTab />
);
}
//active tab is network
else if (this.state.activeTab == 1){
activeTab = (
<NetworkTab />
);
}
//active tab is profile
else{
activeTab = (
<UserTab
logout = {this.logout}
/>
);
}
return (
<div className="container">
<div className="bg"></div>
<div className="main-bg-texture"></div>
<NavBar
graphicsURL = {this.state.graphicsURL}
setActiveTab = {this.setActiveTab}
/>
{activeTab}
{this.needToCheckin() ?
<CheckinModal
graphicsURL = {this.state.graphicsURL}
updateCheckin = {this.updateCheckin}
/>
: null}
</div>
);
}
}
const NavBar = props => {
return (
<nav className="main-nav">
<div className="nav-content">
<img className="logo-img" src={props.graphicsURL+"icon.png"}/>
<span className="logo">my_friends
<span className="sublogo">give and get support.</span>
</span>
<button id="feed-but" onClick={()=>props.setActiveTab(0)}><span className="jam jam-messages-alt" style={{color: '#9FC6C1'}}></span></button>
<button id="network-but" onClick={()=>props.setActiveTab(1)}><span className="jam jam-users" style={{color: '#9FC6C1'}}></span></button>
<button id="user-but" onClick={()=>props.setActiveTab(2)}><span className="jam jam-user" style={{color: '#9FC6C1'}}></span></button>
</div>
</nav>
);
};
class FeedTab extends React.Component {
constructor(props) {
super(props);
}
componentDidMount() {
autosize($('textarea'));
}
render (){
return (
<section className="feed">
<div className="create-thought">
<textarea rows="2" placeholder="Your thoughts"></textarea>
<button id="update">update</button>
</div>
<h1 className="date-marker">February 15</h1>
<div className="checkin activity">
<div className="header">
<div className="pic"></div><span className="name">Gloria Wang </span><span className="sub"> checked in</span><span className="date">A few seconds ago</span>
<button className="user-edit"><span className="jam jam-pencil" style={{color: '#EFF0DA'}}></span></button>
</div>
<div className="content">
<div className="mood"><span>feeling </span>
<div className="mood-icon">5</div>
</div><span>feeling better but still kinda sad because I don't know anyone in my dorm :/ is that just me?</span>
<div className="mood"><span>took meds </span>
<div className="mood-icon"><span className="jam jam-check" style={{color: '#EFF0DA'}}></span></div>
</div>
</div>
<div className="leave-comment">
<input type="text" placeholder="comment.."/>
<button><span className="jam jam-paper-plane" style={{color: '#9FC6C1'}}></span></button>
</div>
</div>
<div className="thought activity">
<div className="header">
<div className="pic"></div><span className="name">Brianna Burman</span><span className="sub"> updated</span><span className="date">12 min ago</span>
</div>
<div className="reply"><span>worried/stressed abt interviews</span></div>
<div className="comment"><span>you got this!!</span></div>
<div className="comment"><span>So awesome you’re planning for them! Since you’re thinking about it, I’m sure you’ll be super prepared!</span></div>
<div className="reply"><span>thx guys :) i appreicate it</span></div>
<div className="leave-comment">
<input type="text" placeholder="comment.."/>
<button><span className="jam jam-paper-plane" style={{color: '#9FC6C1'}}></span></button>
</div>
</div>
</section>
);
}
}
const NetworkTab = props => {
return (
<section className="network">
<div className="header">
<div className="search-bar">
<input type="text" placeholder="search"/>
<button id="search-friends"><span className="jam jam-user-search" style={{color: '#9FC6C1'}}></span></button>
</div>
<button id="add-friends"><span className="jam jam-user-plus" style={{color: '#9FC6C1'}}></span></button>
</div>
<div className="friends">
<div className="friend">
<div className="pic"></div><span>Felicia Wilson</span>
<button><span className="jam jam-heart" style={{color: '#e38882'}}></span></button>
</div>
</div>
</section>
);
};
class UserTab extends React.Component {
constructor(props) {
super(props);
}
render (){
return (
<section className="user">
<button id="edit"><span className="jam jam-pencil" style={{color: '#9FC6C1'}}></span></button>
<div className="pic"></div>
<h1>Gloria Wang</h1>
<div className="check-in-edit">
<h2>Your Daily Check-in</h2>
<ul>
<li>How are you feeling today?</li>
<li>Did you take your medication?</li>
</ul>
<button>add more </button>
</div>
<button id="logout-but" onClick={()=>this.props.logout()}>logout</button>
</section>
);
}
}
class CheckinModal extends React.Component {
constructor(props) {
super(props);
this.state = {
mood: 4
};
}
componentDidMount() {
$( 'input[type="range"]' ).each(function( index ) {
let range = $(this).parent().find('.indicator');
let p = $(range).find('p');
$(range).hide();
$(this).focusin(function () {
$(range).css('left', ('calc('+$(this).val()*(1/7)*100)+'% - 60px)');
$(range).show();
});
$(this).focusout(function () {
$(range).hide();
});
$(this).on('input', function() {
$(range).css('left', ('calc('+$(this).val()*(1/7)*100)+'% - 60px)');
$(p).text($(this).val());
});
});
}
setMood = (event) => {
this.setState({mood: event.target.value});
};
render (){
return (
<div className="modal-bg">
<div className="checkin modal"><img className="bg-texture first" src={this.props.graphicsURL + "flower.png"}/><img className="bg-texture second" src={this.props.graphicsURL + "thing.png"}/>
<div className="bg"></div>
<h1>{moment().format('MMMM D')}</h1>
<h1 className="title">
<div className="highlight"></div><span>check-in</span>
</h1>
<h2>How are you feeling today?</h2>
<div className="mood-measurer">
<input type="range" min="1" max="7" value={this.state.mood} onChange={(e) => this.setMood(e)}/>
<div className="indicator">
<p>4</p>
</div>
<div className="num"><small>1</small><small>7</small></div>
</div>
<textarea className="feelings" placeholder="How am I feeling? .."></textarea>
<h2>Did you take your medication?</h2>
<div className="yesno">
<button className="yes"><span className="jam jam-check" style={{color: 'white'}}></span></button>
<button className="no"><span className="jam jam-close" style={{color: '#8A8184'}}> </span></button>
</div>
<button id="submit" onClick={()=>this.props.updateCheckin()}><span className="jam jam-check" style={{color: '#9FC6C1'}}></span></button>
</div>
</div>
);
}
}
class HomePage extends React.Component {
constructor(props) {
super(props);
this.state = {
signingUp: false,
loggingIn: false
};
}
setSignUp = (bool) => {
this.setState({
signingUp: bool
});
}
setLogin = (bool) => {
this.setState({
loggingIn: bool
});
}
render (){
var content;
if (this.state.loggingIn){
content = (
<div className="login-page">
<h2>my_friends
<button className="back-but" onClick={()=>this.setLogin(false) }>
<span className="jam jam-arrow-left" style={{color: '#635358'}}></span>
</button>
</h2>
<input id="login-email" type="email" placeholder="email"></input>
<input id="login-pass" type="password" placeholder="password"></input>
<button className="login-but" onClick={()=>this.props.checkLogin($('#login-email').val(),$('#login-pass').val()) }>login</button>
</div>
);
}else if (this.state.signingUp){
content = (
<div>
</div>
);
}else{
content = (
<div>
<h2>my_friends</h2>
<p>give and get support from your support network. feel safe with the ones you trust.</p>
<div className="buts">
<button className="signup-but" onClick={()=>this.setSignUp(true)} >sign up</button>
<button className="login-but" onClick={()=>this.setLogin(true) }>login</button>
</div>
</div>
);
}
return (
<div className="home-page">
<img className="bg-texture" src={this.props.graphicsURL+"hero.gif"}/>
<img src={this.props.graphicsURL+"plants.png"}/>
{content}
</div>
);
}
}
ReactDOM.render(<App />, document.getElementById("app"));
Also see: Tab Triggers