Skip to content

Commit

Permalink
refactor: convert React.FC to function components and update prop typ…
Browse files Browse the repository at this point in the history
…e definitions for consistency
  • Loading branch information
1chooo committed Dec 11, 2024
1 parent e494f87 commit a43b186
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
5 changes: 4 additions & 1 deletion apps/web/src/components/about/latest-articles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ const handleSeeMorePostsClick = () => {
})
};

interface LatestArticlesProps {
posts: Post[];
}

const LatestArticles = ({ posts }: { posts: Post[] }) => {
function LatestArticles({ posts }: LatestArticlesProps) {
const [visiblePosts, setVisiblePosts] = useState<Post[]>([]);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/about/life-styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface LifeStylesProps {
lifestyles: LifeStyle[];
}

const LifeStyles: React.FC<LifeStylesProps> = ({ lifestyles }) => {
function LifeStyles({ lifestyles }: LifeStylesProps) {
return (
<section>
<AboutHeader text="$ ls -al Life Style" />
Expand Down
8 changes: 6 additions & 2 deletions apps/web/src/components/about/see-more-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@ interface SeeMoreButtonProps {
}

// TODO: customize button onclick effect https://articles.readytowork.jp/google-analytics-in-next-js-a26cc2b28db5
const SeeMoreButton: React.FC<SeeMoreButtonProps> = ({ badge, path, icon: Icon }) => {
function SeeMoreButton({
badge,
path,
icon: Icon
}: SeeMoreButtonProps) {
return (
<div className="flex justify-center">
<ProgressBarLink href={path}>
<button
className="hover:scale-105 active:scale-95 rounded-xl shadow-lg bg-border-gradient-onyx hover:bg-orange-yellow-crayola-dark z-0 cursor-pointer text-orange-yellow-crayola px-5 py-3 font-bold"
onClick={() => sendGTMEvent({ event: 'buttonClicked', value: 'GTM-PDJ3NF4Q' })}>
<span>{badge}</span>
<Icon className="ml-2 group-hover:ml-2 group-hover:scale-110"/>
<Icon className="ml-2 group-hover:ml-2 group-hover:scale-110" />
</button>
</ProgressBarLink>
</div>
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/about/service-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ interface ServiceItemProps {
lifestyle: LifeStyle;
}

const ServiceItem: React.FC<ServiceItemProps> = ({ lifestyle }) => {
function ServiceItem({ lifestyle }: ServiceItemProps) {
return (
<li className="service-item">
<div className="mb-2.5 sm:mb-0 sm:mt-2 flex justify-center items-center">
<lifestyle.icon className="text-orange-yellow-crayola" size={24}/>
<lifestyle.icon className="text-orange-yellow-crayola" size={24} />
</div>

<div className="text-center sm:text-left">
Expand Down
3 changes: 1 addition & 2 deletions apps/web/src/components/about/tech-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ type TechStack = {
icon: Icon | IconType;
};

const TechItem: React.FC<TechItemProps> = ({ techSteck }) => {

function TechItem({ techSteck }: TechItemProps) {
return (
<li className="service-item">
<div className="tech-stack-container">
Expand Down

0 comments on commit a43b186

Please sign in to comment.