Skip to content

Commit

Permalink
Add council food images
Browse files Browse the repository at this point in the history
  • Loading branch information
albin-karlsson committed Mar 23, 2024
1 parent ae65526 commit 17a6ee4
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions client/src/components/Council.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,31 @@ function Council({ options }) {
alignItems: "center",
};

const foodStyle = {
width: "120px",
height: "120px",
};

const calculateShadow = (index, total) => {
const middleIndex = (total - 1) / 2;
const distance = 5; // Shadow distance
const distanceIncrement = 2; // Increment for distance per index away from the middle

// Calculate the distance based on the index's distance from the middle
const distance = Math.abs(index - middleIndex) * distanceIncrement;

// Determine the shadow direction based on the index
let x = 0;
let y = 0;

if (index < middleIndex) {
x = -distance; // Left shadow
} else if (index > middleIndex) {
x = distance; // Right shadow
}

return `${x}px ${y}px 5px rgba(0,0,0,0.5)`;
return `${x}px 3px 5px rgba(0,0,0,0.5)`;
};

const foodItemStyle = (index, total) => {
const archHeightVW = 3;
const verticalOffsetVW = 7;
const verticalOffsetVW = 6.5;

const middleIndex = (total - 1) / 2;

Expand All @@ -71,7 +76,10 @@ function Council({ options }) {
key={index}
style={foodItemStyle(index, foods.length)}
>
{food}
<img
src={`/images/foods/${food}.png`}
style={foodStyle}
/>
</div>
))}
</div>
Expand Down

0 comments on commit 17a6ee4

Please sign in to comment.