Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
246d0db
feat(init): init html file
GhandchiMorteza Jul 23, 2024
96f75d3
feat(element): creating html elements
GhandchiMorteza Jul 23, 2024
91be58e
feat(doc): add q2 answer doc
GhandchiMorteza Jul 23, 2024
3aa09ff
feat(script): add script file and link that in html
GhandchiMorteza Jul 23, 2024
b67ba41
feat(dom): fetching data and bind that with dom manipulation
GhandchiMorteza Jul 23, 2024
184f3bc
feat(init): duplicate phase 2 and link to css file
GhandchiMorteza Jul 23, 2024
e1d4128
feat(style): basic styling for items
GhandchiMorteza Jul 24, 2024
ee66149
feat(style): add UI styles
GhandchiMorteza Jul 24, 2024
c29c527
fix(style): fix styling issues
GhandchiMorteza Jul 25, 2024
e60a071
feat(asset): adding output files for display result
GhandchiMorteza Jul 25, 2024
c248b0f
refactor(project): create and rename folders
GhandchiMorteza Jul 27, 2024
6470bd1
feat(style): change css into scss files and architect them
GhandchiMorteza Jul 27, 2024
a8b5213
fix(url): update url after changing folder names
GhandchiMorteza Jul 27, 2024
e959a6e
feat(init): duplicate phase 4
GhandchiMorteza Jul 27, 2024
2bdb747
feat(type): declare types
GhandchiMorteza Jul 27, 2024
1dd6844
fix(config): fix compiling issue
GhandchiMorteza Jul 27, 2024
2210a64
feat(setup): setup angular project with ng
GhandchiMorteza Aug 4, 2024
d6d7f2d
fix(format): run prettier format and create header and card components
GhandchiMorteza Aug 4, 2024
4fecae0
feat(card): make the static card for book
GhandchiMorteza Aug 4, 2024
4279683
feat(list): create list of books
GhandchiMorteza Aug 4, 2024
824d42f
feat(api): getting books from json using rxjs
GhandchiMorteza Aug 4, 2024
7d383f9
feat(api): using json server and using pipe to get random image
GhandchiMorteza Aug 4, 2024
532da18
feat(api): deleting cards using button
GhandchiMorteza Aug 4, 2024
c238bf8
feat(style): styling card buttons
GhandchiMorteza Aug 4, 2024
ee5163e
feat(header): add and style header
GhandchiMorteza Aug 7, 2024
e3c54f5
format(project): calling format on the project
GhandchiMorteza Aug 7, 2024
7765c07
chore(dependency): match eslint and prettier
GhandchiMorteza Aug 7, 2024
4b07a88
refactor(syntax): changing for loop
GhandchiMorteza Aug 12, 2024
695026e
feat(markup): using date pip for fomatting date
GhandchiMorteza Aug 12, 2024
45b484e
feat(style): using custom directive for reusing box shadow style
GhandchiMorteza Aug 12, 2024
5c74af6
fix(test): fix test problem with expecting arg
GhandchiMorteza Aug 12, 2024
fac8656
reformat(type): put book interface in separate folder
GhandchiMorteza Aug 12, 2024
8501409
format(project): call prettier format on project
GhandchiMorteza Aug 12, 2024
fda4204
feau(style): add delay to animation update button
GhandchiMorteza Aug 12, 2024
eb033f2
refactor(style): reformat card style
GhandchiMorteza Aug 12, 2024
99ebdf7
feat(style): adding dark mode
GhandchiMorteza Aug 13, 2024
9d1fe5f
feat(style): add toggle dark mode switch
GhandchiMorteza Aug 13, 2024
22d9ce2
feat(style): stick header to the top
GhandchiMorteza Aug 13, 2024
bb65f1b
feat(style): modal add book
GhandchiMorteza Aug 14, 2024
d5528ce
feat(markup): create form add book
GhandchiMorteza Aug 14, 2024
b7be5a8
feat(state): using BehaviorSubject to update state
GhandchiMorteza Aug 14, 2024
f5a92c9
fix(service): set new book id to the max
GhandchiMorteza Aug 14, 2024
6dad2db
feat(modal): add closing and opening modal
GhandchiMorteza Aug 14, 2024
65f408a
feat(modal): close modal on backdrop click
GhandchiMorteza Aug 15, 2024
3166174
feat(error): handling errors using toast notif
GhandchiMorteza Aug 15, 2024
95daea0
feat(style): add animation to the modal
GhandchiMorteza Aug 15, 2024
5a96845
feat(modal): add modal update book
GhandchiMorteza Aug 15, 2024
f52e4db
feat(style): modify light mode colors
GhandchiMorteza Aug 15, 2024
296ac32
fix: delete console log
GhandchiMorteza Aug 15, 2024
8540ed2
fix(style): fix selector style mistake
GhandchiMorteza Aug 15, 2024
b12bf23
fix(markup): fix autocomplete markup issues
GhandchiMorteza Aug 15, 2024
d3ecc24
fix(logic): use deep clone instead of modifing book reference in upda…
GhandchiMorteza Aug 15, 2024
a4fb23d
doc: add description for new phase
GhandchiMorteza Aug 15, 2024
7b54ce6
fix(markup): fix heading content
GhandchiMorteza Aug 15, 2024
4362138
setup(project): creating new angular project for pratices
GhandchiMorteza Aug 16, 2024
3aa6fa9
Merge branch 'Phase06-Angular' into Phase07-RxJs
GhandchiMorteza Aug 16, 2024
32aa5d1
feat(cleanup): cleanup router and markup
GhandchiMorteza Aug 16, 2024
f8267a0
feat(practice1): practice 1 done
GhandchiMorteza Aug 16, 2024
b89b86a
feat(practice2): practice 2 done
GhandchiMorteza Aug 16, 2024
89a306a
feat(practice3): practice 3 done
GhandchiMorteza Aug 16, 2024
1f5d6d9
feat(practice4): practice 4 done
GhandchiMorteza Aug 16, 2024
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
242 changes: 242 additions & 0 deletions Phase02-DOM/books.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
[
{
"name": "The Midnight Library",
"image": "https://picsum.photos/200/300",
"genre": ["Fiction", "Fantasy"],
"author": "Matt Haig",
"publishData": "2020-08-13",
"price": 1499
},
{
"name": "Dune",
"image": "https://picsum.photos/200/300",
"genre": ["Science Fiction", "Adventure"],
"author": "Frank Herbert",
"publishData": "1965-08-01",
"price": 999
},
{
"name": "To Kill a Mockingbird",
"image": "https://picsum.photos/200/300",
"genre": ["Fiction", "Classic"],
"author": "Harper Lee",
"publishData": "1960-07-11",
"price": 799
},
{
"name": "1984",
"image": "https://picsum.photos/200/300",
"genre": ["Dystopian", "Science Fiction"],
"author": "George Orwell",
"publishData": "1949-06-08",
"price": 899
},
{
"name": "The Great Gatsby",
"image": "https://picsum.photos/200/300",
"genre": ["Fiction", "Classic"],
"author": "F. Scott Fitzgerald",
"publishData": "1925-04-10",
"price": 699
},
{
"name": "Harry Potter and the Philosopher's Stone",
"image": "https://picsum.photos/200/300",
"genre": ["Fantasy", "Young Adult"],
"author": "J.K. Rowling",
"publishData": "1997-06-26",
"price": 1099
},
{
"name": "The Catcher in the Rye",
"image": "https://picsum.photos/200/300",
"genre": ["Fiction", "Coming-of-age"],
"author": "J.D. Salinger",
"publishData": "1951-07-16",
"price": 849
},
{
"name": "Pride and Prejudice",
"image": "https://picsum.photos/200/300",
"genre": ["Romance", "Classic"],
"author": "Jane Austen",
"publishData": "1813-01-28",
"price": 599
},
{
"name": "The Hobbit",
"image": "https://picsum.photos/200/300",
"genre": ["Fantasy", "Adventure"],
"author": "J.R.R. Tolkien",
"publishData": "1937-09-21",
"price": 949
},
{
"name": "The Da Vinci Code",
"image": "https://picsum.photos/200/300",
"genre": ["Thriller", "Mystery"],
"author": "Dan Brown",
"publishData": "2003-03-18",
"price": 1299
},
{
"name": "The Alchemist",
"image": "https://picsum.photos/200/300",
"genre": ["Fiction", "Philosophy"],
"author": "Paulo Coelho",
"publishData": "1988-01-01",
"price": 1099
},
{
"name": "Brave New World",
"image": "https://picsum.photos/200/300",
"genre": ["Science Fiction", "Dystopian"],
"author": "Aldous Huxley",
"publishData": "1932-01-01",
"price": 899
},
{
"name": "The Hunger Games",
"image": "https://picsum.photos/200/300",
"genre": ["Young Adult", "Science Fiction"],
"author": "Suzanne Collins",
"publishData": "2008-09-14",
"price": 1199
},
{
"name": "The Shining",
"image": "https://picsum.photos/200/300",
"genre": ["Horror", "Thriller"],
"author": "Stephen King",
"publishData": "1977-01-28",
"price": 1299
},
{
"name": "The Girl with the Dragon Tattoo",
"image": "https://picsum.photos/200/300",
"genre": ["Crime", "Mystery"],
"author": "Stieg Larsson",
"publishData": "2005-08-01",
"price": 1399
},
{
"name": "The Hitchhiker's Guide to the Galaxy",
"image": "https://picsum.photos/200/300",
"genre": ["Science Fiction", "Comedy"],
"author": "Douglas Adams",
"publishData": "1979-10-12",
"price": 999
},
{
"name": "The Kite Runner",
"image": "https://picsum.photos/200/300",
"genre": ["Fiction", "Historical"],
"author": "Khaled Hosseini",
"publishData": "2003-05-29",
"price": 1199
},
{
"name": "The Martian",
"image": "https://picsum.photos/200/300",
"genre": ["Science Fiction", "Adventure"],
"author": "Andy Weir",
"publishData": "2011-09-27",
"price": 1299
},
{
"name": "The Handmaid's Tale",
"image": "https://picsum.photos/200/300",
"genre": ["Dystopian", "Speculative Fiction"],
"author": "Margaret Atwood",
"publishData": "1985-06-14",
"price": 1099
},
{
"name": "The Fault in Our Stars",
"image": "https://picsum.photos/200/300",
"genre": ["Young Adult", "Romance"],
"author": "John Green",
"publishData": "2012-01-10",
"price": 999
},
{
"name": "Sapiens: A Brief History of Humankind",
"image": "https://picsum.photos/200/300",
"genre": ["Non-fiction", "History"],
"author": "Yuval Noah Harari",
"publishData": "2011-01-01",
"price": 1599
},
{
"name": "The Lord of the Rings",
"image": "https://picsum.photos/200/300",
"genre": ["Fantasy", "Epic"],
"author": "J.R.R. Tolkien",
"publishData": "1954-07-29",
"price": 1799
},
{
"name": "Becoming",
"image": "https://picsum.photos/200/300",
"genre": ["Non-fiction", "Autobiography"],
"author": "Michelle Obama",
"publishData": "2018-11-13",
"price": 1499
},
{
"name": "One Hundred Years of Solitude",
"image": "https://picsum.photos/200/300",
"genre": ["Magical Realism", "Literary Fiction"],
"author": "Gabriel García Márquez",
"publishData": "1967-05-30",
"price": 1099
},
{
"name": "The Silent Patient",
"image": "https://picsum.photos/200/300",
"genre": ["Thriller", "Mystery"],
"author": "Alex Michaelides",
"publishData": "2019-02-05",
"price": 1399
},
{
"name": "The Catcher in the Rye",
"image": "https://picsum.photos/200/300",
"genre": ["Fiction", "Coming-of-age"],
"author": "J.D. Salinger",
"publishData": "1951-07-16",
"price": 999
},
{
"name": "Educated",
"image": "https://picsum.photos/200/300",
"genre": ["Non-fiction", "Memoir"],
"author": "Tara Westover",
"publishData": "2018-02-20",
"price": 1299
},
{
"name": "The Pillars of the Earth",
"image": "https://picsum.photos/200/300",
"genre": ["Historical Fiction", "Epic"],
"author": "Ken Follett",
"publishData": "1989-10-01",
"price": 1599
},
{
"name": "The Immortal Life of Henrietta Lacks",
"image": "https://picsum.photos/200/300",
"genre": ["Non-fiction", "Science"],
"author": "Rebecca Skloot",
"publishData": "2010-02-02",
"price": 1199
},
{
"name": "The name of the Wind",
"image": "https://picsum.photos/200/300",
"genre": ["Fantasy", "Adventure"],
"author": "Patrick Rothfuss",
"publishData": "2007-03-27",
"price": 1499
}
]
17 changes: 17 additions & 0 deletions Phase02-DOM/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Phase02</title>
<script src="script.js" defer></script>
</head>
<body>
<div>
<article></article>
<header></header>
<footer></footer>
</div>
<aside></aside>
</body>
</html>
2 changes: 2 additions & 0 deletions Phase02-DOM/q2-answer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
در یک گزارش توضیح دهید چرا استفاده از این ساختار سلسله مراتبی بهتر از استفاده از یک تگ خاص مانند Div برای همه المان ها است؟
به چند دلیل استفاده از این ساختار معنایی بهتر از استفاده از div المنت های معنادار که در HTML5 اضافه شدند، محتوایی که قرار هستند رو مورد نمایش قرار بگیرد را توصیف می کنند. خوانایی html برای برنامه نویس راحت تر می کنه. دوما افراد دارای محدودیت که از اسکرین ریدر استفاده می کنند، دستگاهشون بهتر می تونه محتوای داخل صفحه رو بفهمه و تجربه بهتری برای این افراد ایجاد میشه. سوما موتورهای جستجو برای این المنت های معنادار اهمیت قائله و در صورت استفاده درست از آنها امتیاز قائل میشه و در نتیجه SEO بهتری خواهیم داشت.
43 changes: 43 additions & 0 deletions Phase02-DOM/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// const URL =
// 'https://raw.githubusercontent.com/Star-Academy/codestar-documents/master/static/datasets/books.json';
const URL = 'http://127.0.0.1:5500/Phase02-DOM/books.json';
const article = document.getElementsByTagName('article')[0];

async function fetchBooks(url) {
const response = await fetch(url);
const books = await response.json();
console.log(books);
return books;
}

function dataBinding(books) {
books.forEach((book) => {
const articleDiv = document.createElement('div');

const bookImage = document.createElement('img');
bookImage.src = book.image;

const bookTitle = document.createElement('h3');
bookTitle.textContent = book.name;

const bookAuthor = document.createElement('p');
bookAuthor.textContent = `Author: ${book.author}`;

articleDiv.appendChild(bookImage);
articleDiv.appendChild(bookTitle);
articleDiv.appendChild(bookAuthor);

article.appendChild(articleDiv);
});
}

async function main() {
try {
const books = await fetchBooks(URL);
dataBinding(books);
} catch (error) {
console.log(error);
}
}

main();
Loading