-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚧 feat : work in progress
- Loading branch information
Showing
38 changed files
with
1,723 additions
and
109 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ node_modules | |
dist | ||
dist-ssr | ||
*.local | ||
.env | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
|
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import '@testing-library/jest-dom' | ||
import Link from '.'; | ||
|
||
describe('Link Component', () => { | ||
const testUrl = 'https://example.com'; | ||
const testChildren = 'Click me'; | ||
|
||
it('renders link with correct props', () => { | ||
render(<Link url={testUrl}>{testChildren}</Link>); | ||
|
||
const link = screen.getByRole('link', { name: testChildren }); | ||
expect(link).toHaveAttribute('href', testUrl); | ||
expect(link).toHaveAttribute('target', '_blank'); | ||
expect(link).toHaveAttribute('rel', 'noopener noreferrer'); | ||
}); | ||
|
||
}); |
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,16 @@ | ||
import React from 'react'; | ||
import { ILinkProps } from '../../../interfaces/types'; | ||
import { BLANK } from '../../../utils/constants'; | ||
import { StyledMuiButton } from '../../../utils/styled'; | ||
|
||
const Link = (props: ILinkProps) => { | ||
return ( | ||
<div> | ||
<a href={props.url} target={BLANK} rel="noopener noreferrer"> | ||
<StyledMuiButton>{props.children}</StyledMuiButton> | ||
</a> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Link; |
37 changes: 37 additions & 0 deletions
37
frontend/src/components/atoms/StyledSeparator/index.test.tsx
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,37 @@ | ||
import React from "react"; | ||
import { render } from "@testing-library/react"; | ||
import "@testing-library/jest-dom"; | ||
import StyledSeparator from "."; | ||
import { StyledHorizontalSmallLine, StyledHorizontalLargeLine } from "../../../utils/styled"; | ||
|
||
describe("StyledSeparator Component", () => { | ||
it("renders StyledSeparator with correct styles", () => { | ||
const { container } = render(<StyledSeparator />); | ||
|
||
const smallLine = container.querySelectorAll(".css-1j2jhaj")[0]; | ||
const largeLine = container.querySelectorAll(".css-1ak5guh")[0]; | ||
|
||
expect(smallLine).toHaveStyle( | ||
"border: 1px solid orange; width: 40%; margin-bottom: 10px;" | ||
); | ||
expect(largeLine).toHaveStyle("border: 1px solid orange; width: 50%;"); | ||
}); | ||
|
||
it("renders StyledHorizontalSmallLine with correct styles", () => { | ||
const { container } = render(<StyledHorizontalSmallLine />); | ||
|
||
const smallLine = container.querySelectorAll(".css-1j2jhaj")[0]; | ||
|
||
expect(smallLine).toHaveStyle( | ||
"border: 1px solid orange; width: 40%; margin-bottom: 10px;" | ||
); | ||
}); | ||
|
||
it("renders StyledHorizontalLargeLine with correct styles", () => { | ||
const { container } = render(<StyledHorizontalLargeLine />); | ||
|
||
const largeLine = container.querySelectorAll(".css-1ak5guh")[0]; | ||
|
||
expect(largeLine).toHaveStyle("border: 1px solid orange; width: 50%;"); | ||
}); | ||
}); |
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,13 @@ | ||
import React from 'react' | ||
import { StyledHorizontalSmallLine, StyledHorizontalLargeLine } from '../../../utils/styled'; | ||
|
||
const StyledSeparator = () => { | ||
return ( | ||
<div> | ||
<StyledHorizontalSmallLine /> | ||
<StyledHorizontalLargeLine /> | ||
</div> | ||
); | ||
} | ||
|
||
export default StyledSeparator |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import "@testing-library/jest-dom"; | ||
import Contact from "."; | ||
|
||
describe("Contact Component", () => { | ||
it("renders form fields correctly", () => { | ||
render(<Contact />); | ||
|
||
const nameLabel = screen.getByText("Name"); | ||
expect(nameLabel).toBeInTheDocument(); | ||
}); | ||
|
||
it("submits the form correctly", async () => { | ||
render(<Contact />); | ||
|
||
const nameInput = screen.getByText("Name"); | ||
const messageInput = screen.getByText("Message"); | ||
const phoneNumber = screen.getByText("Phone Number"); | ||
const sendButton = screen.getByText("Send Message"); | ||
|
||
expect(nameInput).toBeInTheDocument(); | ||
expect(messageInput).toBeInTheDocument(); | ||
expect(phoneNumber).toBeInTheDocument(); | ||
expect(sendButton).toBeInTheDocument(); | ||
|
||
}); | ||
}); |
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,36 @@ | ||
import React from "react"; | ||
import { formFields } from "../../../services/mocks/mocks"; | ||
import { Form, FormGroup } from "react-bootstrap"; | ||
import { StyledContact, FormContainer, InputWrapper, SendButton } from "../../../utils/styled"; | ||
import { CONTACT } from "../../../utils/constants"; | ||
|
||
const Contact = () => { | ||
return ( | ||
<StyledContact id={CONTACT}> | ||
<FormContainer> | ||
<Form | ||
action="https://getform.io/f/57d00a1e-cb8c-494a-9257-d5277f3d6880" | ||
method="POST" | ||
encType="multipart/form-data" | ||
> | ||
<FormGroup> | ||
{formFields.map((field) => ( | ||
<InputWrapper key={field.field}> | ||
<label htmlFor={field.field}>{field.name}</label> | ||
{field.type === "textarea" ? ( | ||
<textarea rows={10} name={field.field} /> | ||
) : ( | ||
<input type={field.type} name={field.field} /> | ||
)} | ||
</InputWrapper> | ||
))} | ||
</FormGroup> | ||
<SendButton type="submit">Send Message</SendButton> | ||
</Form> | ||
</FormContainer> | ||
</StyledContact> | ||
); | ||
}; | ||
|
||
export default Contact; | ||
|
15 changes: 15 additions & 0 deletions
15
frontend/src/components/organisms/ContactCard/index.test.tsx
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,15 @@ | ||
import React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import "@testing-library/jest-dom"; | ||
import ContactCard from "."; | ||
import { CONTACT_DESC } from "../../../utils/constants"; | ||
|
||
describe("ContactCard Component", () => { | ||
it("renders contact details correctly", () => { | ||
render(<ContactCard />); | ||
|
||
expect(screen.getByText("Madhurendra Nath Tiwari")).toBeInTheDocument(); | ||
expect(screen.getByText("Software Engineer")).toBeInTheDocument(); | ||
expect(screen.getByText(CONTACT_DESC)).toBeInTheDocument(); | ||
}); | ||
}); |
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,52 @@ | ||
import React from "react"; | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
import { | ||
StyledContactSection, | ||
ContactGrid, | ||
LeftColumn, | ||
ImageContainer, | ||
ContactDetails, | ||
SocialLinks | ||
} from "../../../utils/styled"; | ||
import { | ||
BLANK, | ||
CONTACT_DESC, | ||
CONTACT_IMAGE_URL, | ||
MADHURENDRA_NATH_TIWARI, | ||
SOFTWARE_ENGINEER | ||
} from "../../../utils/constants"; | ||
import { socialLinks } from "../../../services/mocks/mocks"; | ||
|
||
const ContactCard = () => { | ||
return ( | ||
<StyledContactSection> | ||
<ContactGrid> | ||
<LeftColumn> | ||
<ImageContainer> | ||
<img src={CONTACT_IMAGE_URL} alt="/" /> | ||
</ImageContainer> | ||
<ContactDetails> | ||
<h3>{MADHURENDRA_NATH_TIWARI}</h3> | ||
<p>{SOFTWARE_ENGINEER}</p> | ||
<p>{CONTACT_DESC}</p> | ||
</ContactDetails> | ||
<SocialLinks> | ||
{socialLinks.map((social, index) => ( | ||
<a | ||
key={index} | ||
href={social.link} | ||
target={BLANK} | ||
> | ||
<div> | ||
<FontAwesomeIcon icon={social.icon} /> | ||
</div> | ||
</a> | ||
))} | ||
</SocialLinks> | ||
</LeftColumn> | ||
</ContactGrid> | ||
</StyledContactSection> | ||
); | ||
}; | ||
|
||
export default ContactCard; |
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,30 @@ | ||
import React from "react"; | ||
import { fireEvent, render, waitFor, screen } from "@testing-library/react"; | ||
import "@testing-library/jest-dom"; | ||
import Footer from "."; | ||
|
||
jest.mock("../../../services/apicalls/getcall", () => ({ | ||
getQuotes: jest.fn(() => | ||
Promise.resolve({ data: [{ content: "Mocked quote" }] }) | ||
), | ||
})); | ||
|
||
describe("Footer it", () => { | ||
it("Developer name and role are rendered", () => { | ||
render(<Footer />); | ||
expect(screen.getByText("Madhurendra Nath Tiwari")).toBeInTheDocument(); | ||
expect(screen.getByText("Software Engineer")).toBeInTheDocument(); | ||
}); | ||
|
||
it("Social links are rendered", () => { | ||
render(<Footer />); | ||
expect(screen.getAllByRole("link")).toHaveLength(4); | ||
}); | ||
|
||
it("Quotes are fetched and displayed", async () => { | ||
render(<Footer />); | ||
await waitFor(() => { | ||
expect(screen.getByText("Mocked quote")).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.