Skip to content

Commit

Permalink
Update the UI
Browse files Browse the repository at this point in the history
  • Loading branch information
musangamfure committed Jul 1, 2023
1 parent 5254b2a commit b217bd2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
18 changes: 15 additions & 3 deletions src/components/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,29 @@ function Home() {
const categories = useSelector((state) => state.shows.categories);
const allCategories = ['All', ...categories];
const shows = useSelector((state) => state.shows.Shows);
const bgColors = ['#0C2340', '#1D428A'];

const [filteredCategory, setFilteredCategory] = useState('All');

const filteredShows = filteredCategory === 'All'
? shows
: shows.filter((show) => show.category.includes(filteredCategory));

const handleCategory = (event) => {
setFilteredCategory(event.target.value);
};

const renderBackgroundColor = (index) => {
const patternIndex = index % 8;
if (
patternIndex === 0
|| patternIndex === 3
|| patternIndex === 4
|| patternIndex === 7
) {
return '#0C2340';
}
return '#1D428A';
};

return (
<>
<div className="hero">
Expand All @@ -39,7 +51,7 @@ function Home() {
<Show
key={show.id}
Show={show}
backgroundColor={bgColors[index % bgColors.length]}
backgroundColor={renderBackgroundColor(index)}
/>
))}
</div>
Expand Down
1 change: 0 additions & 1 deletion src/styles/Home.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
.shows-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-gap: 20px;
}

@media screen and (max-width: 768px) {
Expand Down
3 changes: 1 addition & 2 deletions src/styles/Show.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
color: var(--light-mode-text);
align-items: flex-end;
background-color: var(--color-white);
margin-bottom: 3rem;

text-decoration: none;
box-shadow: 5px 5px 10px 0 #dfd5d5;
padding-right: 10px;
Expand All @@ -17,7 +17,6 @@
background-color: var(--dark-blue-elements);
color: var(--color-white);
box-shadow: 5px 5px 10px 0;
border-radius: 8px;
}

.show-image {
Expand Down

0 comments on commit b217bd2

Please sign in to comment.