Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
14f32bf
got card to display with an emoji
halahaddad1 Apr 24, 2020
6ae1b74
reorganize board
halahaddad1 Apr 24, 2020
7383443
board and card components display hard coded data
dnguye2 Apr 24, 2020
fb70dfa
can get the card data
dnguye2 Apr 24, 2020
0e06c48
board api get request working
dnguye2 Apr 24, 2020
4679a39
parsing through card work
halahaddad1 Apr 24, 2020
b488317
added emoji css styling
dnguye2 Apr 24, 2020
95a8a43
able to display board and cards from api endpoint
dnguye2 Apr 24, 2020
1fd1112
added cards
halahaddad1 Apr 24, 2020
1d204b8
css styling classNames adjusted
dnguye2 Apr 24, 2020
720e433
merging changes
halahaddad1 Apr 24, 2020
89110b5
merge changes
dnguye2 Apr 24, 2020
d4f443b
removed unneeded comments
dnguye2 Apr 24, 2020
018cbb5
fixed indentation for readability
dnguye2 Apr 24, 2020
8c6a032
removed unneeded console.log message
dnguye2 Apr 24, 2020
28d7893
added and styled takethiscard button-nonfunctional
dnguye2 Apr 24, 2020
db7e6df
card can be deleted but not refreshed automatically
dnguye2 Apr 25, 2020
38c6ea1
able to delete card and automatically render Δ
dnguye2 Apr 25, 2020
42e47e0
can now post new cards! :D
dnguye2 Apr 25, 2020
379c35e
made submit form more aesthetic
dnguye2 Apr 25, 2020
479d247
cleaned up comments and console.logs
dnguye2 Apr 25, 2020
dc2de47
cleaned up console.log
dnguye2 Apr 25, 2020
36ce35e
changed styling of board
dnguye2 Apr 25, 2020
2e851f5
+enzyme and enzyme-adapter-react-16 to run test
dnguye2 Apr 25, 2020
bf0fe89
card snapshot tests created and passed
dnguye2 Apr 25, 2020
72dea37
cleaned up comments and unused variables/imports
dnguye2 Apr 25, 2020
174daa6
shallow NewCardForm snap test created and passed
dnguye2 Apr 25, 2020
e05423e
shallow board test snapshot
dnguye2 Apr 25, 2020
ac024fc
shallow NewCardForm snapshot test completed
dnguye2 Apr 25, 2020
bb723ec
emoji selection changed to dropdown
dnguye2 Apr 25, 2020
184f864
updated styling
dnguye2 Apr 27, 2020
c3ae8c1
added colors that are randomized to cards
dnguye2 Apr 27, 2020
30c89f3
added statements for github deployment
dnguye2 Apr 27, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
315 changes: 315 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
"name": "inspiration-board",
"version": "0.1.0",
"private": true,
"homepage": "https://dnguye3.github.io/inspiration-board/",
"dependencies": {
"axios": "^0.19.2",
"emoji-dictionary": "^1.0.10",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"axios": "^0.19.2",
"emoji-dictionary": "^1.0.10",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1"
Expand All @@ -16,6 +19,8 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"predeploy": "npm-run-build",
"deploy": "gh-pages -d build",
"eject": "react-scripts eject"
},
"eslintConfig": {
Expand Down
15 changes: 9 additions & 6 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import React from 'react';
import './App.css';
import Board from './components/Board';
import React from "react";
import "./App.css";
import Board from "./components/Board";


const App = () => {
return (
<section>
<header className="header">
<h1 className="header__h1"><span className="header__text">Inspiration Board</span></h1>
<h1 className="header__h1">
<span className="header__text">Inspiration Board</span>
</h1>
</header>
<Board
url="https://inspiration-board.herokuapp.com/boards/"
boardName={`Ada-Lovelace`}
url="https://inspiration-board.herokuapp.com/boards/Hala&Diana/cards"
boardName={`Hala&Diana`}
/>
</section>
);
Expand Down
5 changes: 5 additions & 0 deletions src/components/Board.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
.board {
display: flex;
flex-wrap: wrap;
/* centers board */
margin-left: auto;
margin-right: auto;
align-items: center;
justify-content: center;
}

.validation-errors-display {
Expand Down
83 changes: 70 additions & 13 deletions src/components/Board.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,78 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import axios from 'axios';
import React, { useState, useEffect } from "react";
import PropTypes from "prop-types";
import axios from "axios";

import './Board.css';
import Card from './Card';
import NewCardForm from './NewCardForm';
import CARD_DATA from '../data/card-data.json';
import "./Board.css";
import Card from "./Card";
import NewCardForm from "./NewCardForm";

const Board = ({ url }) => {
const [cardList, setCardList] = useState([]);
const [errorMessage, setErrorMessage] = useState(null);

const loadCards = () => {
axios
.get(url)
.then((response) => {
const apiCardList = response.data;
let cardCollection = apiCardList.map((item) => {
return (
<Card
key={item.card.id}
id={item.card.id}
text={item.card.text}
emoji={item.card.emoji}
deleteCardCallback={deleteCard}
/>
);
});
setCardList(cardCollection);
})
.catch((error) => {
const errorMessage = error.message;
setErrorMessage(errorMessage);
console.log(errorMessage);
});
};

useEffect(() => {loadCards();}, []);

const deleteCard = (id) => {
axios.delete(`https://inspiration-board.herokuapp.com/cards/${id}`)
.then((response) => {
loadCards();
})
.catch((error) => {
setErrorMessage(`Unable to delete card ${id}`);
});
// }
};

const postCard = (cardObject) => {
axios
.post(
`https://inspiration-board.herokuapp.com/boards/Hala&Diana/cards`,
cardObject)
.then((response) => {
loadCards();
})
.catch((error) => {
setErrorMessage(`Unable to post card`);
});
};

const Board = () => {
return (
<div>
Board
</div>
)
<div><NewCardForm addCardCallback={postCard} />
<div className="board">
{cardList}
</div>
</div>

);
};
Board.propTypes = {

Board.propTypes = {
url: PropTypes.string
};

export default Board;
43 changes: 43 additions & 0 deletions src/components/Board.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import React from 'react';
import { render, cleanup } from '@testing-library/react'
import Board from './Board';
import NewCardForm from './NewCardForm';

describe ('Board', () => {
// test('renders one card of off the Board', () => {
// const { getByText } = render(<Card />);
// const linkElement = getByText(/nap/i);
// expect(linkElement).toBeInTheDocument();
// });

test('will render the NewCardForm properly', () => {
// Arrange-Act
const { asFragment } = render(
<NewCardForm
addCardCallback={() => { }}
/>
);

// Assert
expect(asFragment()).toMatchSnapshot();
});
})



















129 changes: 126 additions & 3 deletions src/components/Card.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
.card__color-red {
background-color: #E75335;
}

.card__color-yellow {
background-color: #FFD81B;
}

.card__color-green {
background-color: #DCDA47;
}

.card__color-blue {
background-color: #7CA5D1;
}

.card__color-pink {
background-color: #DB73A4;
}

.card {
background-color: #F4FF81;

padding: 1em 0;
margin: 0.5rem;
Expand All @@ -8,15 +27,14 @@
min-width: 225px;
flex-basis: 18%;

border-radius: 5px;

display: grid;
grid-template-columns: 1fr 5fr 1fr;
align-items: center;
}

.card__content {
grid-column-start: 2;
font-family: 'Permanent Marker', Helvetica, sans-serif;

display: flex;
flex-direction: column;
Expand Down Expand Up @@ -44,4 +62,109 @@
.card__delete {
align-self: start;
font-family: 'Permanent Marker', Helvetica, sans-serif;
background-color: black;
border: 1px solid black;
color: white;
}

.card__delete:hover {
background-color: white;
border: 1px solid white;
color: black;
}


/* input text styling */
/* source: https://codepen.io/chrisoncode/pen/IdGKH */
/* form starting stylings ------------------------------- */
.group {
position:relative;
margin-bottom:45px;
}
input {
font-size:18px;
padding:10px 10px 10px 5px;
display:block;
width:300px;
border:none;
border-bottom:1px solid #333;
}
input:focus { outline:none; }

/* LABEL ======================================= */
label {
color:#999;
font-size:18px;
font-weight:normal;
position:absolute;
pointer-events:none;
left:5px;
top:10px;
transition:0.2s ease all;
-moz-transition:0.2s ease all;
-webkit-transition:0.2s ease all;
}

/* active state */
input:focus ~ label, input:valid ~ label {
top:-20px;
font-size:14px;
color:#5264AE;
}

/* BOTTOM BARS ================================= */
.bar { position:relative; display:block; width:300px; }
.bar:before, .bar:after {
content:'';
height:2px;
width:0;
bottom:1px;
position:absolute;
background:#5264AE;
transition:0.2s ease all;
-moz-transition:0.2s ease all;
-webkit-transition:0.2s ease all;
}
.bar:before {
left:50%;
}
.bar:after {
right:50%;
}

/* active state */
input:focus ~ .bar:before, input:focus ~ .bar:after {
width:50%;
}

/* HIGHLIGHTER ================================== */
.highlight {
position:absolute;
height:60%;
width:100px;
top:25%;
left:0;
pointer-events:none;
opacity:0.5;
}

/* active state */
input:focus ~ .highlight {
-webkit-animation:inputHighlighter 0.3s ease;
-moz-animation:inputHighlighter 0.3s ease;
animation:inputHighlighter 0.3s ease;
}

/* ANIMATIONS ================ */
@-webkit-keyframes inputHighlighter {
from { background:#ffff88; }
to { width:0; background:transparent; }
}
@-moz-keyframes inputHighlighter {
from { background:#ffff88; }
to { width:0; background:transparent; }
}
@keyframes inputHighlighter {
from { background:#ffff88; }
to { width:0; background:transparent; }
}
Loading