-
Notifications
You must be signed in to change notification settings - Fork 40
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
chore: create the join or discord and other social links section (WEB-34) #83
Merged
GetBlackBoxSolutions
merged 5 commits into
dallassoftwaredevelopers:main
from
tk1ng:tk1ng/web-34
Apr 28, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0c1fa71
chore: create discord and social links section (WEB-34)
tk1ng 5af0b04
add linkedin url
tk1ng 1a7790c
refactor: use react icons for social icons
tk1ng a36313a
Merge branch 'main' into pr/tk1ng/83
GetBlackBoxSolutions 8d52741
reposition social section
GetBlackBoxSolutions File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { IconContext } from 'react-icons'; | ||
import { SocialLinkData } from './socialSection'; | ||
import styles from './socialSection.module.css'; | ||
|
||
interface SocialLinksProps { | ||
links: SocialLinkData[]; | ||
} | ||
|
||
const SocialLinks = ({ links }: SocialLinksProps) => { | ||
return ( | ||
<IconContext.Provider value={{ color: 'black', size: '7rem' }}> | ||
<ul className={styles.socialLinks}> | ||
{links.map((link) => ( | ||
<li key={link.id}> | ||
<a href={link.link} target='_blank'> | ||
{link.icon} | ||
</a> | ||
</li> | ||
))} | ||
</ul> | ||
</IconContext.Provider> | ||
); | ||
}; | ||
|
||
export default SocialLinks; |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.socialSection { | ||
display: flex; | ||
gap: 4rem; | ||
align-items: center; | ||
padding: 60px 60px 60px 0; | ||
} | ||
|
||
.socialSection p { | ||
font-family: 'Raleway', sans-serif; | ||
font-size: 55px; | ||
} | ||
|
||
.imageContainer { | ||
display: flex; | ||
align-items: center; | ||
justify-content: start; | ||
width: 50%; | ||
height: 500px; | ||
background-color: #0f1034; | ||
border-radius: 0 30px 30px 0; | ||
} | ||
|
||
.imageContainer img { | ||
border-radius: 0 15px 15px 0; | ||
width: 93%; | ||
height: 90%; | ||
} | ||
|
||
.socialLinks { | ||
display: flex; | ||
gap: 2.5rem; | ||
justify-content: space-evenly; | ||
list-style: none; | ||
padding: 0; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import SocialSection from './socialSection'; | ||
|
||
describe('SocialSection', () => { | ||
const mockData = [ | ||
{ | ||
id: 'github', | ||
imgSrc: '/assets/githubIcon.png', | ||
alt: 'Github social icon', | ||
link: 'https://github.com', | ||
}, | ||
{ | ||
id: 'discord', | ||
imgSrc: '/assets/discordIcon.png', | ||
alt: 'Discord social icon', | ||
link: 'https://discord.com', | ||
}, | ||
{ | ||
id: 'meetup', | ||
imgSrc: '/assets/meetupIcon.png', | ||
alt: 'Meetup social icon', | ||
link: '/', | ||
}, | ||
{ | ||
id: 'linkedin', | ||
imgSrc: '/assets/linkedinIcon.png', | ||
alt: 'LinkedIn social icon', | ||
link: '/', | ||
}, | ||
]; | ||
|
||
test('renders SocialSection component', () => { | ||
render(<SocialSection socialData={mockData} />); | ||
|
||
const socialSection = screen.getByTestId('socialSection'); | ||
expect(socialSection).toBeInTheDocument(); | ||
}); | ||
|
||
test('renders all social icons', () => { | ||
render(<SocialSection socialData={mockData} />); | ||
|
||
const linkList = screen.getAllByRole('listitem'); | ||
expect(linkList).toHaveLength(4); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import Image from 'next/image'; | ||
import SocialLinks from './socialLinks'; | ||
import styles from './socialSection.module.css'; | ||
|
||
export interface SocialLinkData { | ||
id: string; | ||
icon: React.ReactNode; | ||
imgSrc: string; | ||
alt: string; | ||
link: string; | ||
} | ||
|
||
interface SocialSectionProps { | ||
socialData: SocialLinkData[]; | ||
} | ||
|
||
export default function SocialSection({ socialData }: SocialSectionProps) { | ||
return ( | ||
<div className={styles.socialSection} data-testid='socialSection'> | ||
<div className={styles.imageContainer}> | ||
<Image | ||
src='/assets/joinOurDiscord.png' | ||
alt='' | ||
width={500} | ||
height={350} | ||
/> | ||
</div> | ||
<div> | ||
<p> | ||
Join our Discord and <br /> other social links! | ||
</p> | ||
<p> | ||
This is YOUR community, | ||
<br /> be a part of it! | ||
</p> | ||
<SocialLinks links={socialData} /> | ||
</div> | ||
</div> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
This is a slimmer version of the `useMediaQuery` hook from [useHooks-ts](https://usehooks-ts.com/react-hook/use-media-query) | ||
|
||
This hook uses the [`matchMedia()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia) method of the `Window` object to check for matching conditions against a media query passed into the hook. | ||
|
||
`useMediaQuery` takes a media query argument passed as a string: | ||
|
||
`useMediaQuery('(max-width: 750px)')` |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useState, useEffect } from 'react'; | ||
|
||
const useMediaQuery = (query: string): boolean => { | ||
const [isMatch, setIsMatch] = useState<boolean>(false); | ||
|
||
useEffect(() => { | ||
const mediaQueryList = window.matchMedia(query); | ||
setIsMatch(mediaQueryList.matches); | ||
|
||
mediaQueryList.onchange = (event) => { | ||
setIsMatch(event.matches); | ||
}; | ||
}, [query]); | ||
|
||
return isMatch; | ||
}; | ||
|
||
export default useMediaQuery; |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking this could be defined using CSS variables, along with other global styles like specific theme colors, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a great idea. Lets create another ticket for adding global css variables to tackle consistency across the web app.