Skip to content

Commit

Permalink
interview cta, change text on news to summary->breakdown
Browse files Browse the repository at this point in the history
  • Loading branch information
GraemeFulton committed Jun 6, 2024
1 parent a6d0b61 commit 02cc2e4
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 7 deletions.
1 change: 0 additions & 1 deletion app/dashboard/tagged/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import Layout from "@/components/new-index/layoutForApp";
import { HOME_OG_IMAGE_URL } from "@/lib/constants";
import Dashboard from "@/components/Dashboard/Dashboard";
import Navigation from "@/components/Dashboard/navigation";

export const metadata = {
title: "Dashboard | Prototypr",
description: "Edit your posts, drafts, and tools on Prototypr",
Expand Down
134 changes: 134 additions & 0 deletions components/StickyFooterInterview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import { motion } from "framer-motion";
import { useEffect, useState } from "react";
import Button from "./Primitives/Button";
import Link from "next/link";
import Container from "./container";
// import { Cross2Icon } from "@radix-ui/react-icons";
// import { set, get } from "js-cookie";

export function getScrollPercent() {
var h = document.documentElement,
b = document.body,
st = "scrollTop",
sh = "scrollHeight";
return ((h[st] || b[st]) / ((h[sh] || b[sh]) - h.clientHeight)) * 100;
}

const StickyFooterInterview = ({ title, description, buttonText }) => {
const [isVisible, setVisible] = useState(true);
// const [userClosed, setUserClosed] = useState(false);

// Define the scrollListener inside useEffect or use useCallback
useEffect(() => {
const scrollListener = () => {
const p = getScrollPercent(); // Assuming getScrollPercent is defined elsewhere

if (p > 0 && p < 99) {
setVisible(true);
} else {
setVisible(false);
}
};

window.addEventListener("scroll", scrollListener);

// Clean up function
return () => {
window.removeEventListener("scroll", scrollListener);
};
}, []); // Re-attach the event listener if userClosed changes

const closeStickyFooter = () => {
setVisible(false);
// set("closed-signup", "true", { expires: 365 }); // Set a cookie to remember the user's choice, assuming a 1-year expiration
// setUserClosed(true);
};

return (
<div className="w-full flex justify-center relative ">
<motion.div
initial="hidden"
animate={isVisible ? "visible" : "hidden"}
variants={{
visible: {
opacity: 1,
y: 0,
// x:'50%',
// originX:0.5,
transition: { type: "spring", stiffness: 200, damping: 32 },
},
hidden: {
opacity: 0,
y: 100,
// originX:0.5,
// x:'50%',
transition: { duration: 0.2 },
},
}}
// className="fixed bottom-0 rounded-none md:bottom-4 max-w-3xl w-full px-5 py-4 h-auto md:rounded-2xl border border-black border-opacity-10 bg-[#2f62c7] z-[100]"
className="fixed bottom-0 w-full md:bottom-3 bg-gradient-to-t shadow-md overflow- from-blue-50 border border-indigo-900/10 to-white md:w-[80%] md:max-w-[1120px] md:rounded-2xl h-auto z-[100]"
>
<img
src={`/static/images/robo2.png`}
className="w-[76px] md:w-[104px] drop-shadow-xl z-40 ml-[160px] md:ml-0 left-0 absolute bottom-0 -mb-[15px] md:-mb-[25px] md:-scale-x-100"
/>
<Container maxWidth="max-w-[1320px] z-30 relative overflow-">
{/* <div
onClick={closeStickyFooter}
className="rounded-full cursor-pointer z-50 w-[22px] flex flex-col justify-center h-[22px] shadow-sm border border-gray-300 absolute top-0 bg-white right-0 -mt-[6px] -mr-[6px]"
>
<div className="mx-auto">
<Cross2Icon width={14} />
</div>
</div> */}
<div className="absolute top-0 left-0 w-full h-full md:rounded-2xl overflow-hidden">
<div className="relative w-full h-full overflow-hidden md:rounded-2xl">
<div
className=" absolute top-0 left-0 w-[110%] h-[110%] -mt-1 -ml-0.5 md:rounded-2xl"
style={{
backgroundColor: "#ffffff",
opacity: "0.1",
backgroundImage:
"linear-gradient(#203490 1.5px, transparent 1.5px), linear-gradient(to right, #203490 1.5px, #ffffff 1.5px)",
backgroundSize: "30px 30px",
}}
/>
</div>
</div>

<div className="w-full z-10 relative px-1 py-3 flex flex-col gap-4 md:gap-3 md:flex-row justify-between">
<div className="flex flex-row md:justify-center md:items-center gap-4 md:gap-4">
<div></div>
<div className="flex flex-col md:ml-[80px]">
<h1 className="text-xl tracking-tight font-bold text-black/00">
{/* {title ? title : `Become a member`} */}
Tell your <span className="text-underline inline cursor-collab">creator story</span> 🎙️
</h1>
<p className="text-lg font-semibold max-w-xl text-black/80">
Get featured by sharing your journey of creating this tool.
{/* {description
? description
: `Get published, collect tools, and earn rewards.`} */}
</p>
</div>
</div>
<div className="my-auto ml-4 md:ml-0 flex-none w-full md:w-[fit-content] md:block flex justify-start md:justify-end">
<Link className="w-[fit-content]" href="/onboard">
<Button
className="py-1 md:w-auto p-0 py-[0.1rem] bg-yellow-300/90 hover:bg-yellow-300 text-yellow-900 px-[1rem]"
variant={"confirmRounded"}
>
Get featured
</Button>
</Link>
</div>
{/* <button className="px-7 h-10 md:h-auto text-sm text-black shadow-sm py-0 rounded-full bg-white">
Sign up
</button> */}
</div>
</Container>
</motion.div>
</div>
);
};
export default StickyFooterInterview;
15 changes: 10 additions & 5 deletions components/v4/layout/NewsPageFeatured.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ const NewsPageFeatured = ({
{post.attributes?.outgoingLinks?.length?<div className="col-span-8 lg:col-span-2 max-h-[1200px] relative">
<h1
tabIndex={0}
className="text-base mb-2.5 font-semibold tracking-tight"
className="text-xl mb-3 font-semibold tracking-tight"
>
References
Explore links in this article
</h1>
<div className=" lg:overflow-x-auto flex gap-4">
{/* <p className="mb-2.5 text-sm text-gray-600">Referenced in this article</p> */}
<div className="overflow-x-auto flex gap-4">
<div className="z-10 absolute p-4 z-10 -mr-8 hidden md:block pointer-events-none bottom-0 right-0 h-full w-32 bg-gradient-to-l from-[#fbfcff]" />

{post.attributes.outgoingLinks.map((link, index) => {
Expand Down Expand Up @@ -114,12 +115,16 @@ const NewsPageFeatured = ({

{content !== excerpt ? (
<div className="col-span-2 w-[48rem] max-w-full mx-auto border-t border-gray-100/80 p-6 lg:p-8 mt-6 w-full flex flex-col">
<div className="flex gap-1 mb-4">
<svg className="h-6 w-6 my-auto" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><polygon points="160 16 144 96 208 120 96 240 112 160 48 136 160 16" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg>
<h1
tabIndex={0}
className="text-2xl mb-4 font-medium tracking-tight"
className="text-2xl my-auto font-medium tracking-tight"
>
Summary
Breakdown
</h1>

</div>
<div
className="text-lg text-gray-800 blog-content news-content"
dangerouslySetInnerHTML={{ __html: content }}
Expand Down
6 changes: 6 additions & 0 deletions lib/queries/singleToolQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,14 @@ export default `
}
}
}
interviews{
data{
id
}
}
creators {
data {
id
attributes {
name: username
displayName:username
Expand Down
12 changes: 11 additions & 1 deletion pages/toolbox/[slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import Carousel from "@/components/carousel";
const StickyFooterCTA = dynamic(() => import("@/components/StickyFooterCTA"), {
ssr: false,
});
const StickyFooterInterview = dynamic(() => import("@/components/StickyFooterInterview"), {
ssr: false,
});
// const AuthorCard = dynamic(() => import("@/components/toolbox/AuthorCard"));
// const SponsorCard = dynamic(() => import("@/components/toolbox/SponsorCard"));
// const RelatedPosts = dynamic(() => import("@/components/related-posts"));
Expand All @@ -43,7 +46,7 @@ import { TOTAL_STATIC_POSTS } from "@/lib/constants";
import ToolLargeCardRow from "@/components/v4/layout/ToolLargeCardRow";
import AuthorCard from "@/components/toolbox/AuthorCard";
import SignupSidebar from "@/components/newsletter/SignupSidebar";
import ToolCard from "@/components/v4/card/ToolCard";
// import ToolCard from "@/components/v4/card/ToolCard";
// import WeeMan from "@/components/images/weeMan";
import buildToolboxGallery, {
getToolboxFeaturedImage,
Expand Down Expand Up @@ -91,6 +94,7 @@ const ToolContent = ({
}
}, [post.attributes?.content]);


return (
<>
<div className="w-full mx-auto">
Expand Down Expand Up @@ -445,6 +449,12 @@ const ToolContent = ({
description="Join today to make posts and grow with us."
/>
)}

{(user?.isLoggedIn && post?.attributes?.creators?.data?.some(item => item.id == user.id) && !post.attributes?.interviews?.data?.length) && (
<>
<StickyFooterInterview title="Tell your creator story" description={"Get featured in the newsletter by answering a creator interview"} />
</>
)}
{/* <NewsletterSection title="Get the best tools every week"/> */}
</>
);
Expand Down

0 comments on commit 02cc2e4

Please sign in to comment.