update styles

This commit is contained in:
davidwells 2018-06-11 22:16:07 -07:00
parent c236cc7ac6
commit 51d2330169
3 changed files with 101 additions and 21 deletions

View file

@ -1,17 +1,23 @@
.App {
text-align: center;
}
.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 80px;
height: 95px;
margin-right: 20px;
}
.app-title-wrapper {
display: flex;
align-items: center;
}
.App-header {
background-color: #222;
height: 150px;
height: 105px;
padding: 20px;
color: white;
padding-left: 40px;
}
.App-title {
@ -22,6 +28,35 @@
font-size: large;
}
.todo-list {
padding: 50px;
padding-top: 10px;
width: 600px;
}
.todo-create-wrapper {
margin-bottom: 20px;
}
.todo-create-input {
padding: 12px 10px;
min-width: 300px;
display: inline-block;
box-shadow: 0px 0px 0px 2px rgba(69, 101, 173, 0.1);
border: none;
outline: none;
transition: all 0.3s ease;
}
.todo-create-input:hover, .todo-create-input:active, .todo-create-input:focus {
box-shadow: 0px 0px 0px 2px rgb(43, 190, 185);
box-shadow: 0px 0px 0px 2px #00ad9f;
}
.todo-item {
padding: 15px 0;
display: flex;
align-items: center;
justify-content: space-between;
}
@keyframes App-logo-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }

View file

@ -20,9 +20,6 @@ class App extends Component {
})
})
}
logState = () => {
console.log(this.state)
}
saveTodo = (e) => {
e.preventDefault();
const { todos } = this.state
@ -33,6 +30,9 @@ class App extends Component {
return false
}
// reset input
this.inputElement.value = ''
// Optimistically add todo to UI
const temporaryValue = {
data: {
@ -114,10 +114,19 @@ class App extends Component {
return todos.map((todo, i) => {
const { data, ref } = todo
const id = getTodoId(todo)
console.log('id', id)
// only show delete button after create API response returns
let deleteButton
if (ref) {
deleteButton = (
<button data-id={id} onClick={this.deleteTodo}>delete</button>
)
}
return (
<div key={i} style={{borderBottom: '1px solid black', padding: 20}}>
{data.title} <button data-id={id} onClick={this.deleteTodo}>delete</button>
<div key={i} className='todo-item'>
<div>
{data.title}
</div>
{deleteButton}
</div>
)
})
@ -126,25 +135,35 @@ class App extends Component {
return (
<div className="App">
<header className="App-header">
<div className="app-title-wrapper">
<img src={logo} className="App-logo" alt="logo" />
<div>
<h1 className="App-title">Netlify + Fauna DB</h1>
</header>
<p className="App-intro">
Using FaunaDB & netlify functions
</p>
<div>
<button onClick={this.logState}>log state</button>
</div>
</div>
</header>
<div className='todo-list'>
<h2>Create todo</h2>
<form className='feature-add' onSubmit={this.saveTodo}>
<input placeholder='Todo Info' name='name' ref={el => this.inputElement = el} />
<button>
<form className='todo-create-wrapper' onSubmit={this.saveTodo}>
<input
className='todo-create-input'
placeholder='Add a todo item'
name='name'
ref={el => this.inputElement = el}
autocomplete='off'
style={{marginRight: 20}}
/>
<button className='todo-create-button'>
Create todo
</button>
</form>
</div>
{this.renderTodos()}
</div>
</div>
)
}
}

View file

@ -3,3 +3,29 @@ body {
padding: 0;
font-family: sans-serif;
}
button {
padding: 7px 15px;
font-family: inherit;
font-weight: 500;
font-size: 16px;
line-height: 24px;
text-align: center;
border: 1px solid #e9ebeb;
border-bottom: 1px solid #e1e3e3;
border-radius: 4px;
background-color: #fff;
color: rgba(14,30,37,.87);
box-shadow: 0 2px 4px 0 rgba(14,30,37,.12);
transition: all .2s ease;
transition-property: background-color,color,border,box-shadow;
outline: 0;
cursor: pointer;
}
button:focus, button:hover {
background-color: #f5f5f5;
color: rgba(14,30,37,.87);
box-shadow: 0 8px 12px 0 rgba(233,235,235,.16), 0 2px 8px 0 rgba(0,0,0,.08);
text-decoration: none;
}