Skip to content

Commit

Permalink
Merge pull request #27 from sean1832/dev
Browse files Browse the repository at this point in the history
Minor Patch: Expandable Text Component Enhancements and UI Fixes
  • Loading branch information
sean1832 authored Jun 5, 2024
2 parents d477327 + 6b4cbe6 commit 5927bfa
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 13 deletions.
2 changes: 0 additions & 2 deletions app/page.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import About from "@/components/section/about";
import Landing from "@/components/section/landing";
import ProjectsGallery from "@/components/section/projects-gallery";
import GithubFloatingButton from "@/components/ui/button/githubFloatingButton";

export default function Home() {
return (
Expand All @@ -10,7 +9,6 @@ export default function Home() {
<Landing />
<About />
<ProjectsGallery />
<GithubFloatingButton />
</div>
</main>
);
Expand Down
2 changes: 1 addition & 1 deletion components/section/project-info.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const ProjectInfo = ({ data }) => {
<div className="xlg:hidden">
<div className="text-primary">
<strong>Description: </strong>
<ExpandableText maxLength={500}>{data.longDescription}</ExpandableText>
<ExpandableText breakpoint="sm">{data.longDescription}</ExpandableText>
</div>
</div>

Expand Down
8 changes: 4 additions & 4 deletions components/ui/button/githubFloatingButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import manifest from "@/data/manifest";

const GithubFloatingButton = () => {
return (
<Link href={manifest.repository.url} target="_blank">
<Link href={manifest.repository.url} target="_blank" className="hidden lg:block">
<FloatingButton
scrollOffset={300}
className="h-8 md:w-[152px] w-8 opacity-80 hover:opacity-100"
className="h-8 md:w-[152px] w-8 opacity-80 hover:opacity-100 "
>
<GitHubLogoIcon className="h-6 w-6 md:h-4 md:w-4 md:mr-2" />
<div className="hidden md:block"> View on GitHub</div>
<GitHubLogoIcon className="h-6 w-6 md:h-4 md:w-4 md:mr-2 " />
View on GitHub
</FloatingButton>
</Link>
);
Expand Down
39 changes: 34 additions & 5 deletions components/ui/expandableText.jsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,42 @@
"use client";
import { useState } from "react";
import { Button } from "./button";
import props from "prop-types";

const ExpandableText = ({ children }) => {
const ExpandableText = ({ children, breakpoint }) => {
const [isExpanded, setIsExpanded] = useState(false);

const toggleExpansion = () => {
setIsExpanded(!isExpanded);
};

const text = children;
const breakpointVariants = {
sm: {
mobile: "sm:hidden block",
desktop: "hidden sm:block",
},
md: {
mobile: "md:hidden block",
desktop: "hidden md:block",
},
lg: {
mobile: "lg:hidden block",
desktop: "hidden lg:block",
},
xlg: {
mobile: "xlg:hidden block",
desktop: "hidden xlg:block",
},
};

const size = breakpointVariants[breakpoint];

return (
<>
{/* mobile view */}
<div className="lg:hidden block">
<div className={size.mobile}>
<div className={`relative overflow-hidden ${!isExpanded ? "h-48" : "h-auto"}`}>
<p>{text}</p>
<p>{children}</p>
{!isExpanded && (
<div className="absolute bottom-0 left-0 w-full h-12 bg-gradient-to-b from-transparent to-background"></div>
)}
Expand All @@ -29,9 +49,18 @@ const ExpandableText = ({ children }) => {
</div>

{/* desktop view */}
<div className="hidden lg:block">{text}</div>
<div className={size.desktop}>{children}</div>
</>
);
};

ExpandableText.propTypes = {
children: props.node.isRequired,
breakpoint: props.string.isRequired,
};

ExpandableText.defaultProps = {
breakpoint: "md",
};

export default ExpandableText;
2 changes: 1 addition & 1 deletion data/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Zeke Zhang Portfolio",
"version": "0.1.0",
"version": "0.2.0",
"description": "My personal portfolio website built with Next.js and Tailwind CSS. The website showcases my past projects, skills, and experiences.",
"repository": {
"type": "git",
Expand Down

0 comments on commit 5927bfa

Please sign in to comment.