Skip to content

Commit

Permalink
Long overdue initial commit, created Layout(Header and Footer), TaskL…
Browse files Browse the repository at this point in the history
…ist, TaskCard, and ButtonForm components, along with redux folders, and stylings for all components etc.
  • Loading branch information
Alan-eMartin committed Oct 21, 2020
1 parent 7353d47 commit e4a2098
Show file tree
Hide file tree
Showing 28 changed files with 15,569 additions and 10,951 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
.env.development.local
.env.test.local
.env.production.local
.vscode

npm-debug.log*
yarn-debug.log*
Expand Down
14,734 changes: 14,734 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"node-sass": "^4.14.1",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-scripts": "3.4.3"
"react-redux": "^7.2.1",
"react-scripts": "3.4.3",
"redux": "^4.0.5",
"uuid": "^8.3.1"
},
"scripts": {
"start": "react-scripts start",
Expand Down
2 changes: 2 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&family=Pacifico&display=swap"
rel="stylesheet">
<title>React App</title>
</head>
<body>
Expand Down
38 changes: 0 additions & 38 deletions src/App.css

This file was deleted.

26 changes: 0 additions & 26 deletions src/App.js

This file was deleted.

36 changes: 36 additions & 0 deletions src/app/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react';
import '../styles/App.scss';
// Components
import Layout from '../components/Layout/index';
import TaskList from '../components/TaskList';
import ButtonForm from '../components/ButtonForm/index'
// Redux
import { connect } from 'react-redux'

const App = (props) => {

const { list } = props;

return (
<div className='App'>
<Layout>
{
list.map(list => (
<TaskList
title={list.title}
cards={list.cards}
key={list.id}
/>
))
}
<ButtonForm list/>
</Layout>
</div>
);
}

const mapStateToProps = state => ({
list: state.list,
})

export default connect(mapStateToProps) (App);
File renamed without changes.
98 changes: 98 additions & 0 deletions src/components/ButtonForm/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import React, {useState, useEffect } from 'react';
import AddIcon from '@material-ui/icons/Add';
import CloseIcon from '@material-ui/icons/Close';
import './style.scss';

const ButtonForm = (props) => {
// State
const [openForm, setOpenForm] = useState(false)
const [text, setText] = useState('')

// Props
const { list } = props;

// Open
const open = () => {
setOpenForm(!openForm)
}

// Close
const close = () => {
setOpenForm(false)
}

// Handle Textfield Change
const handleInputChange = (e) => {
setText(e.target.value)
}

// Handle Textfield Submit
const handleSubmit = (e) => {
e.preventDefault()
}

// Conditional Button
const renderButton = () => {
const buttonText = list ? 'Add another list' : 'Add another card';

return (
<button
className={list ? 'add-list-button' : 'add-card-button'}
onClick={() => open()}
>
<span className="add-button-text">
<AddIcon /> {buttonText}
</span>
</button>
)
}

// Conditional Form
const renderForm = () => {

const placeholder = list
? 'Enter a title for this list...'
: 'Enter a title for this card...';

const title = list
? 'Add List'
: 'Add Card';

return (
<>
<form
className={list ? 'add-list-form' : 'add-card-form'}
>
<textarea
className={list ? 'task-list add-list-input' :'add-card-input'}
placeholder={placeholder}
value={text}
onBlur={() => close()}
onChange={handleInputChange}
autoFocus
/>
<div className="form-button-container">
<button
className={list ? 'add-list-input-button' : 'add-card-input-button'}
title={title}
onSubmit={() => handleSubmit()}
>
{title}
</button>
<button
className="close-form-button"
onClick={() => close()}
>
<CloseIcon fontSize={"large"}/>
</button>
</div>

</form>
</>
);
}

return openForm ? renderForm() : renderButton()
}

export default ButtonForm;
103 changes: 103 additions & 0 deletions src/components/ButtonForm/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// Button Styles
button {
padding: none;
font-size: 1.5rem;
padding: 1rem;
transition: all 0.2s;
border: none;
background-color: transparent;

&:hover {
cursor: pointer;
}
}

.add-card-button,
.add-list-button {
width: 100%;
border-radius: 0.5rem;
transition: all 0.05s ease-in;
text-align: left;
transition: all 0.2s;
}

.add-card-button {
span {
opacity: 0.7;

&:focus,
&:hover {
opacity: 1;
cursor: pointer;
}
}

&:focus,
&:hover {
background-color: #d9dce2;
}
}

.add-list-button {
margin-top: 1rem;
background-color: #ebecf080;
width: 300px;
height: 100%;

&:focus,
&:hover {
background-color: #ebecf095;
}

span {
color: #fff;
}
}

// Form Styles

.add-card-input-button,
.add-list-input-button {
background-color: #5aac44;
color: #fff;
border: 0.05rem solid #bbbbbb;
border-radius: 0.5rem;

&:focus,
&:hover {
background-color: lighten(#5aac44, 10%);
}
}

.form-button-container {
display: flex;
}

.close-form-button {
color: lighten(#000, 30%);

&:focus,
&:hover {
color: #000;
}
}

.add-list-form {
margin-top: 1rem;
height: 100%;
background-color: #ffffffdc;
padding: 1rem;
}

.add-list-form,
.add-list-input {
border-radius: 0.5rem;
}

.add-list-input {
width: 100%;
min-width: 300px;
margin-bottom: 1rem;
padding: 1rem;
border: 0.2rem solid #0079bf;
}
14 changes: 14 additions & 0 deletions src/components/Layout/Footer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react';
import './style.scss';

const Footer = () => {
return (
<footer className="footer">
<p className="copyright">
Created by <a href="alan-martin.dev" title='Click here to visit alan-martin.dev'>Alan Martin &copy;</a>
</p>
</footer>
)
}

export default Footer;
14 changes: 14 additions & 0 deletions src/components/Layout/Footer/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.footer {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: 0;
right: 0;
left: 0;
height: 3rem;

a {
color: black;
}
}
12 changes: 12 additions & 0 deletions src/components/Layout/Header/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import './style.scss';

const Header = () => {
return (
<header className="header">
<h1 className='site-title'>Trello Clone</h1>
</header>
)
}

export default Header;
Loading

0 comments on commit e4a2098

Please sign in to comment.