Skip to content

Commit

Permalink
migrated all FeaturedJobItem components to .tsx and updated snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
recondesigns committed Mar 4, 2024
1 parent 0f97bbf commit 539341d
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 81 deletions.
59 changes: 0 additions & 59 deletions components/FeaturedJobItem/FeaturedJobItem.js

This file was deleted.

104 changes: 104 additions & 0 deletions components/FeaturedJobItem/FeaturedJobItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
// import { string, bool } from 'prop-types';
import OutboundLink from 'components/OutboundLink/OutboundLink';
import BuildingIcon from 'static/images/icons/FontAwesome/building_icon.svg';
import CloudUploadIcon from 'static/images/icons/FontAwesome/cloud_upload_icon.svg';
import MapMarkerIcon from 'static/images/icons/FontAwesome/map_marker_icon.svg';

// FeaturedJobItem.propTypes = {
// title: string.isRequired,
// source: string.isRequired,
// sourceUrl: string.isRequired,
// city: string,
// state: string,
// country: string,
// description: string.isRequired,
// remote: bool,
// };

export type FeaturedJobItemPropsType = {
/**
* Title of the feautured job item.
*/
title: string;
/**
* Description of the featured job item.
*/
description: string;
/**
* Source of the featured job item.
*/
source: string;
/**
* Url for the source of the featured job item.
*/
sourceUrl: string;
/**
* Applies an optional state for the featured job.
*/
city?: string;
/**
* Applies an optional state for the featured job.
*/
state?: string;
/**
* Applies an optional country for the featured job.
*/
country?: string;
/**
* Applies an indicator that the featured job is remote.
* @default false
*/
remote?: boolean;
};

// FeaturedJobItem.defaultProps = {
// remote: false,
// city: '',
// state: '',
// country: '',
// };

function FeaturedJobItem({
title,
source,
sourceUrl,
city,
state,
country,
description,
remote = false,
}: FeaturedJobItemPropsType) {
return (
<article className="px-0 py-4">
<OutboundLink href={sourceUrl} analyticsEventLabel={`Featured Job ${source}`}>
<h6>{title}</h6>
</OutboundLink>

<div className="flex flex-wrap mt-1 text-lg text-themeSecondary opacity-80 ">
<div className="flex items-center gap-1.5">
<BuildingIcon className="fill-themeSecondary opacity-80 h-3.5" />
<span className="ml-1">{source}</span>
</div>

<div className="flex items-center gap-1.5">
{(city || state || country) && (
<MapMarkerIcon className="fill-themeSecondary opacity-80 h-3.5" />
)}
{city && <span className="ml-1">{city},</span>}
{state && <span className="ml-1">{state},</span>}
{country && <span className="ml-1">{country}</span>}
</div>

{remote && (
<div className="flex items-center gap-1.5">
<CloudUploadIcon className="fill-themeSecondary opacity-80 h-3.5" />
<span className="ml-1">Remote</span>
</div>
)}
</div>
<p className="m-0">{description}</p>
</article>
);
}

export default FeaturedJobItem;
18 changes: 0 additions & 18 deletions components/FeaturedJobItem/__stories__/FeaturedJobItem.stories.js

This file was deleted.

41 changes: 41 additions & 0 deletions components/FeaturedJobItem/__stories__/FeaturedJobItem.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { Meta, StoryObj } from '@storybook/react'
import { descriptions } from 'common/constants/descriptions';
import FeaturedJobItem from '../FeaturedJobItem';

type FeaturedJobItemStoryType = StoryObj<typeof FeaturedJobItem>

const meta: Meta<typeof FeaturedJobItem> = {
title: 'FeaturedJobItem',
component: FeaturedJobItem
}

export default meta

/**
* Default FeaturedJobItem supplied with only required args.
*/
export const Default: FeaturedJobItemStoryType = {
render: args => <FeaturedJobItem {...args} />,
args: {
title: 'Job Title',
source: 'Company Name',
sourceUrl: '#',
description: descriptions.long,
}
}

// export default {
// component: FeaturedJobItem,
// title: 'FeaturedJobItem',
// };

// const Template = arguments_ => <FeaturedJobItem {...arguments_} />;

// // Default FeaturedJobItem supplied with only required args
// export const Default = Template.bind({});
// Default.args = {
// title: 'Job Title',
// source: 'Company Name',
// sourceUrl: '#',
// description: descriptions.long,
// };
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`FeaturedJobItem > should render with many props assigned 1`] = `
<article
className="py-4 px-0"
className="px-0 py-4"
>
<a
className="inline-flex items-start"
Expand Down Expand Up @@ -31,7 +31,7 @@ exports[`FeaturedJobItem > should render with many props assigned 1`] = `
/>
</a>
<div
className="flex flex-wrap text-lg text-themeSecondary opacity-80 mt-1 "
className="flex flex-wrap mt-1 text-lg text-themeSecondary opacity-80 "
>
<div
className="flex items-center gap-1.5"
Expand Down Expand Up @@ -110,7 +110,7 @@ exports[`FeaturedJobItem > should render with many props assigned 1`] = `

exports[`FeaturedJobItem > should render with required props 1`] = `
<article
className="py-4 px-0"
className="px-0 py-4"
>
<a
className="inline-flex items-start"
Expand Down Expand Up @@ -139,7 +139,7 @@ exports[`FeaturedJobItem > should render with required props 1`] = `
/>
</a>
<div
className="flex flex-wrap text-lg text-themeSecondary opacity-80 mt-1 "
className="flex flex-wrap mt-1 text-lg text-themeSecondary opacity-80 "
>
<div
className="flex items-center gap-1.5"
Expand Down

0 comments on commit 539341d

Please sign in to comment.