Skip to content

Conversation

@bjoernholmlund
Copy link

No description provided.

Copy link

@Demijuls Demijuls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job, very impressed with how simple and clean the code is!


/* Layout */
--container-max: 1200px;
--page-pad: 16px;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great use of semantic tokens! Easy to read

</h1>

<!-- Buttons för filter av -->
<section class="buttonarea">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great naming of sections, very easy to read!

<section class="buttonarea">
<div class="filter" aria-label="Filter & Sort">
<div class="group">
<div class="btn-row">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, intent is clear



<!-- Recipe Cards -->
<section class="recipe-cards" id="recipe-cards">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall very clean code, great job!

--page-pad: 16px;
}

* {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also like to use * as a way to make it easier to style everything after, but since it might slow down the loading of the site, I would probably just double-check that this property is really a must one

.btn:hover, .btn-time:hover, .btn-random:hover{
border-color: var(--h1);
}
.btn:active, .btn-time:active, .btn-random:active{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding active state overall is a great idea for better UX, however, here the change feels a little bit too subtle maybe? Although it is not critical, just a small thing

filterBtns.forEach(btn => {
btn.addEventListener('click', () => {
currentCuisine = btn.dataset.cuisine || 'all';
setActive(filterBtns, btn);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also consider adding .active state to CSS to indicate to users which filter is currently in use after they pressed it? It's a small UX improvement though, the code looks very nice and clean to me!

sortBtns: buttons that set up/down by time
randomBtn: the button that shows a random recipe
*/
const grid = document.querySelector('.recipe-grid');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work with namings for filterBtn, sortBtn, randomBtn, very self-explanatory! Maybe grid could follow the same pattern? It might be a "fall-back" for human reading in the future:)

console.log('[SORT CLICK]', { dataset: btn.dataset.sort, currentSortDir });
const testUrl = buildUrl({ cuisine: currentCuisine, sortDir: currentSortDir, number: 14 });
console.log('[URL]', testUrl);
setActive(sortBtns, btn);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same idea for .active here:)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall great JS work, very clean, simple, short and so easy to follow!

@JennieDalgren JennieDalgren self-assigned this Oct 26, 2025
Copy link

@JennieDalgren JennieDalgren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job with this project!

Your code is well structured snd easy to follow. Remember to stick to english in your comments through out the project. It makes it easier for the reviewers to read your code.

You have met the requirements and some stretch goals too.

Keep up the good work!

Comment on lines +2 to +7
--bg: #FAFBFF;
--h1: #0018A4;
--h2: black;
--h3: #6F6F6F;
--button1: rgb(204, 255, 226);
--button2: rgb(255, 236, 234);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

css variables! yay

color: var(--h1);
font-size: 65px;
font-weight: bold;
/* margin: 50px 0; */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Comment on lines +58 to +62
.buttonarea, .filter{
display: block; /* block på mobil */
width: 100%; /* släpp var(--group-width) */
/* height: auto; <-- implicit */
box-sizing: border-box;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the comments, or translate them to english if you need them

Comment on lines +63 to +64
padding-left: max(clamp(12px, 6vw, 20px), env(safe-area-inset-left));
padding-right: max(clamp(12px, 6vw, 20px), env(safe-area-inset-right));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you comfortable explaining what this styling does? if not, this might be a good place to add some comments that explains it.

Comment on lines +157 to +164
transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.recipe-card:hover {
border-color: var(--h1);
transform: translateY(-2px);
box-shadow: 0 4px 12px var(--recipe-shadow-hover);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

smooth subtle animation on the hover

Comment on lines +27 to +34
const params = new URLSearchParams({
apiKey: API_KEY,
number: String(number),
addRecipeInformation: "true",
instructionsRequired: "true",
sort: "time",
sortDirection: sortDir,
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice use of URLSearchParams

Comment on lines +40 to +48
/*
STATE
Variables that tell us what the user has selected
(kitchen and sorting) and which recipes were most recently retrieved.
When you click the buttons, these values ​​are updated – and we retrieve new recipes.
*/
let currentCuisine = 'all';
let currentSortDir = 'asc';
let currentRecipes = [];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good use of comments and global variables

Comment on lines +197 to +198
document.querySelector('.btn[data-cuisine="all"]')?.classList.add('active');
document.querySelector('.btn-time[data-sort="asc"]')?.classList.add('active');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if these are active as default, you could set them in the html straight away

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants