-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add create post with click, refresh list and other details; wip; #129
- Loading branch information
Showing
32 changed files
with
1,058 additions
and
17 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
.Button { | ||
padding: .4rem; | ||
background-color: transparent; | ||
background-color: #17191e; | ||
font-size: 1rem; | ||
border: 1px solid var(--first-color); | ||
border-radius: 0.3rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ | |
background-color: transparent; | ||
font-size: 1rem; | ||
border: 1px solid var(--first-color); | ||
border-radius: 0.3rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
class Input extends Compnent { | ||
class Input extends Component { | ||
constructor() { | ||
super('input') | ||
|
||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
class Label extends Component { | ||
constructor() { | ||
super('label') | ||
|
||
this.addClass('Label') | ||
} | ||
|
||
setFor(id) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
const data = {} | ||
|
||
data.findUser = callback => { | ||
let usersJson = localStorage.users | ||
|
||
if (!usersJson) usersJson = '[]' | ||
|
||
const users = JSON.parse(usersJson) | ||
|
||
const user = users.find(callback) | ||
|
||
return user | ||
} | ||
|
||
data.insertUser = user => { | ||
let usersJson = localStorage.users | ||
|
||
if (!usersJson) usersJson = '[]' | ||
|
||
const users = JSON.parse(usersJson) | ||
|
||
users.push(user) | ||
|
||
usersJson = JSON.stringify(users) | ||
|
||
localStorage.users = usersJson | ||
} | ||
|
||
data.findPosts = callback => { | ||
let postsJson = localStorage.posts | ||
|
||
if (!postsJson) postsJson = '[]' | ||
|
||
const posts = JSON.parse(postsJson) | ||
|
||
const filtered = posts.filter(callback) | ||
|
||
return filtered | ||
} | ||
|
||
data.insertPost = post => { | ||
let postsJson = localStorage.posts | ||
|
||
if (!postsJson) postsJson = '[]' | ||
|
||
const posts = JSON.parse(postsJson) | ||
|
||
post.id = `${Math.random().toString().slice(2)}-${Date.now()}` | ||
|
||
posts.push(post) | ||
|
||
postsJson = JSON.stringify(posts) | ||
|
||
localStorage.posts = postsJson | ||
} | ||
|
||
data.deletePost = callback => { | ||
let postsJson = localStorage.posts | ||
|
||
if (!postsJson) postsJson = '[]' | ||
|
||
const posts = JSON.parse(postsJson) | ||
|
||
const index = posts.findIndex(callback) | ||
|
||
if (index > -1) { | ||
posts.splice(index, 1) | ||
|
||
postsJson = JSON.stringify(posts) | ||
|
||
localStorage.posts = postsJson | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
class ContentError extends Error { | ||
constructor(messsage) { | ||
super(message) | ||
|
||
//this.name = ContentError.name | ||
this.name = this.constructor.name | ||
} | ||
} | ||
|
||
class MatchError extends Error { | ||
constructor(message) { | ||
super(message) | ||
|
||
this.name = this.constructor.name | ||
} | ||
} | ||
|
||
class DuplicityError extends Error { | ||
constructor(message) { | ||
super(message) | ||
|
||
this.name = this.constructor.name | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@import url('https://fonts.googleapis.com/css2?family=Freeman&display=swap'); | ||
|
||
/* @import url('https://fonts.googleapis.com/css2?family=Workbench&display=swap'); */ | ||
|
||
:root { | ||
--first-color: #7799E5; | ||
--second-color: #17191e; | ||
} | ||
|
||
* { | ||
font-family: Freeman; | ||
color: var(--first-color); | ||
} | ||
|
||
body { | ||
background-color: var(--second-color); | ||
margin: 0; | ||
} |
21 changes: 21 additions & 0 deletions
21
staff/jose-pozo/socialcode/app/home/components/CreatePostForm.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.CreatePostForm { | ||
width: 85%; | ||
margin-top: 6rem; | ||
position: fixed; | ||
top: 6rem; | ||
background: #17191e; | ||
border: 1px solid #7799E5; | ||
border-radius: 0.3rem; | ||
} | ||
|
||
.Button.SubmitButton.create-post { | ||
width: 100%; | ||
margin-top: 2rem; | ||
/*color: #ff6022;*/ | ||
color: #00E8C4; | ||
} | ||
|
||
.Button.SubmitButton.create-post:hover { | ||
background-color: #f73a1c; | ||
cursor: pointer; | ||
} |
43 changes: 43 additions & 0 deletions
43
staff/jose-pozo/socialcode/app/home/components/CreatePostForm.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
class CreatePostForm extends FormWithFeedback { | ||
constructor() { | ||
super() | ||
|
||
this.addClass('CreatePostForm') | ||
|
||
const titleField = new Field('title', 'text', 'Title') | ||
titleField.setPlaceholder('title') | ||
|
||
const imageField = new Field('image', 'text', 'Image') | ||
imageField.setPlaceholder('image') | ||
|
||
const descriptionField = new Field('description', 'text', 'Desciption') | ||
descriptionField.setPlaceholder('description') | ||
|
||
const submitButton = new SubmitButton('Create') | ||
//submitButton.addClass('SubmitButton') | ||
submitButton.addClass('create-post'); | ||
|
||
this.add(titleField) | ||
this.add(imageField) | ||
this.add(descriptionField) | ||
this.add(submitButton) | ||
} | ||
|
||
getTitle() { | ||
const titleField = this.children[0] | ||
|
||
return titleField.getValue() | ||
} | ||
|
||
getImage() { | ||
const imageField = this.children[1] | ||
|
||
return imageField.getValue() | ||
} | ||
|
||
getDescription() { | ||
const descriptionField = this.children[2] | ||
|
||
return descriptionField.getValue() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
.Post {} | ||
|
||
.LoggedUser { | ||
color: #70FACB; | ||
margin-top: 2rem; | ||
margin-bottom: 0; | ||
} | ||
|
||
.PostHeader { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: end; | ||
margin-top: 2rem; | ||
margin-bottom: 0; | ||
} | ||
|
||
.AuthorTitle { | ||
color: #2AC195; | ||
} | ||
|
||
.edit-icon { | ||
width: 1rem; | ||
} | ||
|
||
.edit-icon:hover { | ||
cursor: pointer; | ||
} | ||
|
||
.edit-list { | ||
list-style: none; | ||
position: absolute; | ||
right: 5%; | ||
text-align: right; | ||
font-size: 1.5rem; | ||
background-color: #17191e; | ||
} | ||
|
||
.item-list:hover { | ||
cursor: pointer; | ||
} | ||
|
||
.PostTitle { | ||
color: #f4f4f4; | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.PostImage { | ||
width: 100%; | ||
border-radius: 5px; | ||
} | ||
|
||
.PostDescription { | ||
color: #f4f4f4; | ||
} | ||
|
||
.PostDate { | ||
color: #8190BB; | ||
} | ||
|
||
.StraightLine { | ||
border-color: #7799E5; | ||
} |
Oops, something went wrong.