diff --git a/src/components/MainPageLayout.js b/src/components/MainPageLayout.js index 65a5491..030161e 100644 --- a/src/components/MainPageLayout.js +++ b/src/components/MainPageLayout.js @@ -10,8 +10,48 @@ import ChevronRight from "@mui/icons-material/ChevronRight"; import { Link } from "react-router-dom"; import SharedCarousel from "./SharedCarousel.js"; import { getCombinedAnimatedBorderStyles } from "../utils/animatedBorderStyles.js"; +import { STAR_POLYGON_POINTS } from "../utils/starPolygon.js"; import { useTranslation } from 'react-i18next'; +const HOME_STAR_LAYERS = [ + { className: "star-rotate-slow-cw", size: 168, staticDeg: 20, fill: "#B8860B" }, + { className: "star-rotate-slow-ccw", size: 159, staticDeg: -25, fill: "#DAA520" }, + { className: "star-rotate-medium-cw", size: 150, staticDeg: null, fill: "#FFD700" }, +]; + +const FILIALE_STAR_LAYERS = [ + { className: "star-rotate-slow-ccw", size: 168, staticDeg: 20, fill: "#5F9EA0" }, + { className: "star-rotate-medium-cw", size: 159, staticDeg: -25, fill: "#7FCDCD" }, + { className: "star-rotate-slow-cw", size: 150, staticDeg: null, fill: "#AFEEEE" }, +]; + +const StarDecorationLayers = ({ layers }) => ( + <> + {layers.map(({ className, size, staticDeg, fill }, i) => { + const half = size / 2; + return ( +
+ + + +
+ ); + })} + +); + const ContentBox = ({ box, index, pageType, starHovered, setStarHovered, opacity, translatedContent }) => ( {index === 0 && pageType === "home" && ( @@ -29,19 +69,11 @@ const ContentBox = ({ box, index, pageType, starHovered, setStarHovered, opacity display: { xs: 'none', sm: 'block' } }} > - - - - - - - - - -
+ +
{translatedContent.outdoorSeason}
-
+
{translatedContent.selectSeedRate}
@@ -61,16 +93,8 @@ const ContentBox = ({ box, index, pageType, starHovered, setStarHovered, opacity display: { xs: 'none', sm: 'block' } }} > - - - - - - - - - -
+ +
{translatedContent.showUsPhoto}
@@ -92,8 +116,16 @@ const ContentBox = ({ box, index, pageType, starHovered, setStarHovered, opacity transition: "all 0.3s ease", "&:hover": { transform: "translateY(-5px)", boxShadow: 20 }, }} - onMouseEnter={index === 0 && pageType === "filiale" ? () => setStarHovered(true) : undefined} - onMouseLeave={index === 0 && pageType === "filiale" ? () => setStarHovered(false) : undefined} + onMouseEnter={ + (pageType === "home" && index === 0) || (pageType === "filiale" && index === 1) + ? () => setStarHovered(true) + : undefined + } + onMouseLeave={ + (pageType === "home" && index === 0) || (pageType === "filiale" && index === 1) + ? () => setStarHovered(false) + : undefined + } > {opacity === 1 && ( @@ -134,6 +166,12 @@ const MainPageLayout = () => { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } } + .star-rotate-slow-cw, + .star-rotate-slow-ccw, + .star-rotate-medium-cw { + transform-box: fill-box; + transform-origin: center; + } .star-rotate-slow-cw { animation: rotateClockwise 60s linear infinite; } diff --git a/src/components/Product.js b/src/components/Product.js index 745cfcd..48c3b2d 100644 --- a/src/components/Product.js +++ b/src/components/Product.js @@ -10,6 +10,7 @@ import AddToCartButton from './AddToCartButton.js'; import { Link, useNavigate } from 'react-router-dom'; import { withI18n } from '../i18n/withTranslation.js'; import ZoomInIcon from '@mui/icons-material/ZoomIn'; +import { STAR_POLYGON_POINTS } from '../utils/starPolygon.js'; // Helper function to find level 1 category ID from any category ID const findLevel1CategoryId = (categoryId) => { @@ -302,7 +303,7 @@ class Product extends Component { }} > @@ -321,7 +322,7 @@ class Product extends Component { }} > @@ -334,7 +335,7 @@ class Product extends Component { height="50" > diff --git a/src/utils/starPolygon.js b/src/utils/starPolygon.js new file mode 100644 index 0000000..4e8740e --- /dev/null +++ b/src/utils/starPolygon.js @@ -0,0 +1,2 @@ +export const STAR_POLYGON_POINTS = + "30,2 36.286,21.348 56.63,21.348 40.172,33.305 46.458,52.652 30,40.695 13.542,52.652 19.828,33.305 3.37,21.348 23.714,21.348";