-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3014 from Giveth/update-community-links
updated community links
- Loading branch information
Showing
5 changed files
with
96 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,76 @@ | ||
import React from 'react'; | ||
import React, { FC } from 'react'; | ||
import Link from 'next/link'; | ||
import { Caption, GLink } from '@giveth/ui-design-system'; | ||
import styled from 'styled-components'; | ||
import { GLink } from '@giveth/ui-design-system'; | ||
import { useIntl } from 'react-intl'; | ||
import { useAppSelector } from '@/features/hooks'; | ||
import { ItemRow, ItemTitle } from './common'; | ||
import Routes from '@/lib/constants/Routes'; | ||
import { Item } from './Item'; | ||
import links from '@/lib/constants/links'; | ||
|
||
export const CommunityItems = () => { | ||
const theme = useAppSelector(state => state.general.theme); | ||
const { formatMessage } = useIntl(); | ||
|
||
const communityItems = [ | ||
{ | ||
title: formatMessage({ id: 'label.giver_nfts' }), | ||
label: formatMessage({ id: 'label.collection_of' }), | ||
href: Routes.NFT, | ||
}, | ||
{ | ||
title: formatMessage({ id: 'label.join_and_keep_in_touch' }), | ||
label: formatMessage({ id: 'label.community_of_makers' }), | ||
href: Routes.Join, | ||
}, | ||
]; | ||
const communityItems = [ | ||
{ | ||
title: 'label.get_a', | ||
label: 'label.givers_nft', | ||
href: Routes.NFT, | ||
}, | ||
{ | ||
title: 'label.learn_how_to', | ||
label: 'label.join_us', | ||
href: Routes.Join, | ||
}, | ||
{ | ||
title: 'label.discover_our', | ||
label: 'label.mission', | ||
href: links.OUR_MISSION, | ||
isExternal: true, | ||
}, | ||
]; | ||
|
||
export const CommunityItems = () => { | ||
return ( | ||
<> | ||
{communityItems.map((item, idx) => ( | ||
<Link key={idx} href={item.href}> | ||
<Item theme={theme}> | ||
<ItemTitle theme={theme}>{item.title}</ItemTitle> | ||
<ItemRow> | ||
<GLink>{item.label}</GLink> | ||
</ItemRow> | ||
</Item> | ||
</Link> | ||
))} | ||
{communityItems.map((item, idx) => | ||
item.isExternal ? ( | ||
<a | ||
key={idx} | ||
href={item.href} | ||
target='_blank' | ||
rel='noopener noreferrer' | ||
> | ||
<CommunityItem item={item} /> | ||
</a> | ||
) : ( | ||
<Link key={idx} href={item.href}> | ||
<CommunityItem item={item} /> | ||
</Link> | ||
), | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
const LabelStyle = styled(Caption)` | ||
margin: 24px 16px 16px; | ||
`; | ||
interface ICommunityItemProps { | ||
item: { | ||
title: string; | ||
label: string; | ||
href: string; | ||
isExternal?: boolean; | ||
}; | ||
} | ||
|
||
export const CommunityItem: FC<ICommunityItemProps> = ({ item }) => { | ||
const theme = useAppSelector(state => state.general.theme); | ||
const { formatMessage } = useIntl(); | ||
|
||
return ( | ||
<Item theme={theme}> | ||
<ItemTitle theme={theme}> | ||
{formatMessage({ id: item.title })} | ||
</ItemTitle> | ||
<ItemRow> | ||
<GLink>{formatMessage({ id: item.label })}</GLink> | ||
</ItemRow> | ||
</Item> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters