Skip to content

Commit

Permalink
feat: contact details component
Browse files Browse the repository at this point in the history
  • Loading branch information
mikevespi committed Jun 23, 2022
1 parent d4fc967 commit 85df151
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions app/components/Contact/ContactDetails.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { graphql, useFragment } from "react-relay";
import { ContactDetails_contact$key } from "__generated__/ContactDetails_contact.graphql";

interface Props {
contact: ContactDetails_contact$key;
}

const ContactDetails: React.FC<Props> = ({ contact }) => {
const contactDetails = useFragment(
graphql`
fragment ContactDetails_contact on Contact {
email
companyName
contactPosition
}
`,
contact
);

const { email, companyName, contactPosition } = contactDetails;

return (
<div>
<p>
<span>Email</span> {email}
</p>
{companyName && (
<p>
<span>Company</span> {companyName}
</p>
)}
{contactPosition && (
<p>
<span>Position</span> {contactPosition}
</p>
)}
<style jsx>{`
div p {
margin-bottom: 0;
}
div span {
font-weight: bold;
}
`}</style>
</div>
);
};

export default ContactDetails;

0 comments on commit 85df151

Please sign in to comment.