diff --git a/src/App.css b/src/App.css index c5c6e8a..9a877c3 100644 --- a/src/App.css +++ b/src/App.css @@ -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); } diff --git a/src/App.js b/src/App.js index 117a53e..42c6dc4 100644 --- a/src/App.js +++ b/src/App.js @@ -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 = ( + + ) + } return ( -
- {data.title} +
+
+ {data.title} +
+ {deleteButton}
) }) @@ -126,24 +135,34 @@ class App extends Component { return (
- logo -

Netlify + Fauna DB

+
+ logo +
+

Netlify + Fauna DB

+

+ Using FaunaDB & netlify functions +

+
+
-

- Using FaunaDB & netlify functions -

-
- + +

Create todo

-
- this.inputElement = el} /> -
+ {this.renderTodos()}
- - {this.renderTodos()}
) } diff --git a/src/index.css b/src/index.css index b4cc725..76ff592 100644 --- a/src/index.css +++ b/src/index.css @@ -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; +}