Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 18 additions & 4 deletions src/components/Banner/Banner.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react"
import React, { useEffect, useState } from "react"
import { Link } from "gatsby"
import ReactMarkdown from "react-markdown"
import Lottie from 'react-lottie'
Expand All @@ -17,17 +17,28 @@ const Banner = ({ data }) => {
const diagonalReverseState =
variant === "diagonalReverse" ? "col-md-4" : "col-lg-6"

console.log(image)
console.log(image?.url)

const [lottieLight, setLottieLight] = useState(null)

const defaultOptions = {
loop: true,
autoplay: true,
rendererSettings: {
preserveAspectRatio: 'xMidYMid slice'
},
path: image?.url,
}

useEffect(() => {
//if (image.mime === "application/json") {

fetch(image?.url, {
method: 'GET', // or 'PUT'
}).then(res => res.json())
.catch(error => console.error('Error:', error))
.then(res => setLottieLight(res));
}, [])

return (
<div
className={`banner ${variant}`}
Expand Down Expand Up @@ -62,7 +73,10 @@ const Banner = ({ data }) => {
>
{/* <img src={image?.url} alt={title} /> */}

{image?.mime === "application/json" ? <Lottie options={{ ...defaultOptions }} /> : <img
{image?.mime === "application/json" ? <Lottie options={{
...defaultOptions,
animationData: lottieLight,
}} /> : <img
src={theme === "dark" && imageDark ? imageDark?.url : image?.url}
alt={title}
/>}
Expand Down
1 change: 1 addition & 0 deletions src/components/DualSection/DualSection.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
&-img {
flex-basis: 55%;
img {
border-radius: 8px;
width: 100%;
padding: 0;
}
Expand Down
22 changes: 18 additions & 4 deletions src/components/Text/Text.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
background-color: $primary-container;
border-radius: 10px;
p:first-child {
padding-top: 1rem;
padding-top: 29px;
}
p {
color: $primary;
Expand All @@ -26,13 +26,27 @@
padding-bottom: 3rem;

.notTitle {
display: flex;
flex-direction: column;
justify-content: center;
color: $primary;
border-radius: 20px;
background-color: $primary-container;
padding: 1rem;
margin: 1.5rem 0rem;
p:nth-last-child(-n + 2) {
padding: 0rem 1rem;

p:first-child {
padding-top: 29px;
}

h6 {
margin-bottom: 0px;

&:last-child {
padding-bottom: 29px;
}
strong {
font-size: 16px !important;
}
}
}
}
Expand Down