-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* port partners/results to TSX * Make the change and get test coverage * Code review issues Remove dialog-context, pass title/setTitle around Remove commented-out stars and count Stop re-shuffling partners every time you view details Use Object.keys instead of Reflect.ownKeys * Fix tests * Remove equity rating filter functionality
- Loading branch information
1 parent
ea3d97f
commit 7b7e836
Showing
19 changed files
with
1,919 additions
and
3,756 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import cmsFetch from '~/helpers/cms-fetch'; | ||
|
||
export default cmsFetch('salesforce/partners'); | ||
|
||
export const tooltipText = 'Features verified by instructors who use OpenStax'; |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import React from 'react'; | ||
import {useNavigate} from 'react-router-dom'; | ||
import type {PartnerEntry} from './results'; | ||
|
||
function modelFromEntry(entry: PartnerEntry) { | ||
return { | ||
type: entry.type, | ||
title: entry.title, | ||
logoUrl: entry.logoUrl, | ||
description: entry.blurb, | ||
tags: entry.tags, | ||
badgeImage: '/dist/images/partners/verified-badge.svg' | ||
}; | ||
} | ||
|
||
function ResultCard({entry}: {entry: PartnerEntry}) { | ||
const {type, title, logoUrl, tags} = | ||
modelFromEntry(entry); | ||
const navigate = useNavigate(); | ||
const onSelect = React.useCallback( | ||
(event: React.MouseEvent<HTMLAnchorElement>) => { | ||
event.preventDefault(); | ||
const href = event.currentTarget.getAttribute('href'); | ||
|
||
navigate(href as string, {replace: true}); | ||
}, | ||
[navigate] | ||
); | ||
|
||
return ( | ||
<a | ||
href={`?${encodeURIComponent(title)}`} | ||
type="button" | ||
className="card" | ||
onClick={onSelect} | ||
data-analytics-select-content={title} | ||
data-content-type="Partner Profile" | ||
data-content-tags={`,category=${type},`} | ||
> | ||
<div className="logo"> | ||
{logoUrl && <img src={logoUrl} alt="" />} | ||
</div> | ||
<div className="resource-title">{title}</div> | ||
<div className="tags"> | ||
{tags.map(({value}) => ( | ||
<div key={value}>{value}</div> | ||
))} | ||
</div> | ||
</a> | ||
); | ||
} | ||
|
||
export default function ResultGrid({entries}: {entries: PartnerEntry[]}) { | ||
return ( | ||
<div className="boxed grid"> | ||
{entries.map((entry) => ( | ||
<ResultCard key={entry.title} entry={entry} /> | ||
))} | ||
</div> | ||
); | ||
} |
Oops, something went wrong.