Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controlling the member card style using the use TextDirection hook #254

Closed
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
2 changes: 1 addition & 1 deletion app/[locale]/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function NotFound() {
<p>{t('paragraph')}</p>
<Link
href={LINKS.HOME}
className="w-[250px] my-8 text-xs discord-btn rounded-full px-7 py-2 flex items-start justify-center gap-2 dark:hover:bg-purple-200 item-hover-transition items-center"
className="w-[250px] my-8 text-xs discord-btn rounded-full px-7 py-2 flex justify-center gap-2 dark:hover:bg-purple-200 item-hover-transition items-center"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing redundant class to clear problem from the the terminal

>
{t('home')}{' '}
<div className="fill-white dark:fill-black">
Expand Down
7 changes: 6 additions & 1 deletion components/Members/MemberCard/MemberCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { MemberCardInfo } from './MemberCardInfo';
import { MemberCardSocialButtons } from './MemberCardSocialButtons';
import { MemberCardInfoProps } from '../../../types';
import useTextDirection from '@/hooks/useTextDirection';

type MemberCardProps = MemberCardInfoProps;

Expand All @@ -16,8 +17,12 @@ export const MemberCard = ({
twitterUrl,
githubUrl,
}: MemberCardProps) => {
const direction = useTextDirection();
return (
<div dir='rtl' className="flex bg-purple-100 dark:bg-gray-600 rounded-2xl shadow-md w-full xl:w-[400px] xl:h-[173px]">
<div
dir={direction}
className="flex bg-purple-100 dark:bg-gray-600 rounded-2xl shadow-md w-full xl:w-[400px] xl:h-[173px]"
>
<MemberCardInfo
imgUrl={imgUrl}
name={name}
Expand Down
9 changes: 8 additions & 1 deletion components/Members/MemberCard/MemberCardInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import ImageWithFallback from '@/components/utils/ImageWithFallback';
import { MemberCardProps } from '../../../types';
import Crown from '@/components/SvgCmps/Crown';
import useTextDirection from '@/hooks/useTextDirection';

export const MemberCardInfo = ({
imgUrl,
Expand All @@ -11,8 +12,14 @@ export const MemberCardInfo = ({
joinDate,
isAdmin,
}: MemberCardProps) => {
const direction = useTextDirection();
return (
<div className="flex flex-col rounded-md p-[10px] pr-6 w-full">
<div
dir={direction}
className={`flex flex-col rounded-md p-[10px] ${
direction === 'rtl' ? 'pr-6' : 'pl-6'
} w-full`}
>
<div className="flex gap-4">
<ImageWithFallback
width="50"
Expand Down
10 changes: 9 additions & 1 deletion components/Members/MemberCard/MemberCardSocialButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { TwitterMemberLink } from './socialIcons/TwiterMemberLink';
import { LinkedInMemberLink } from './socialIcons/LinkedInMemberLink';
import { GithubMemberLink } from './socialIcons/GithubMemberLink';
import useTextDirection from '@/hooks/useTextDirection';

interface MemberCardSocialButtonsProps {
linkedInUrl: string;
Expand All @@ -14,8 +15,15 @@ export const MemberCardSocialButtons = ({
twitterUrl,
githubUrl,
}: MemberCardSocialButtonsProps) => {
const direction = useTextDirection();
return (
<div className="flex flex-col w-[67px] bg-purple-200 justify-evenly dark:bg-gray-800 rounded-tl-2xl rounded-bl-2xl shadow-2xl">
<div
className={`flex flex-col w-[67px] bg-purple-200 justify-evenly dark:bg-gray-800 shadow-2xl ${
direction === 'rtl'
? 'rounded-tl-2xl rounded-bl-2xl'
: 'rounded-tr-2xl rounded-br-2xl'
}`}
>
<LinkedInMemberLink linkedInUrl={linkedInUrl} />
<TwitterMemberLink twitterUrl={twitterUrl} />
<GithubMemberLink githubUrl={githubUrl} />
Expand Down
Loading