-
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.
Use different Give links for different download types
- Loading branch information
1 parent
d2e6259
commit 1977cc4
Showing
2 changed files
with
34 additions
and
3 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
28 changes: 28 additions & 0 deletions
28
src/app/pages/details/common/get-this-title-files/give-before-pdf/give-links.ts
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 {useLocation} from 'react-router-dom'; | ||
|
||
// Two Give link options for each of: PDF downloads, Instructor resources, Student resources | ||
export default function useGiveLinks() { | ||
const {search} = useLocation(); | ||
|
||
return React.useMemo(() => getLinks(search), [search]); | ||
} | ||
|
||
function getLinks(search: string) { | ||
if (search.includes('Instructor')) { | ||
return [ | ||
'https://riceconnect.rice.edu/donation/support-openstax-instructor-resources', | ||
'https://riceconnect.rice.edu/donation/support-openstax-instructor-resources-b' | ||
]; | ||
} | ||
if (search.includes('Student')) { | ||
return [ | ||
'https://riceconnect.rice.edu/donation/support-openstax-student-resources', | ||
'https://riceconnect.rice.edu/donation/support-openstax-student-resources-b' | ||
]; | ||
} | ||
return [ | ||
'https://riceconnect.rice.edu/donation/support-openstax-subject', | ||
'https://riceconnect.rice.edu/donation/support-openstax-subject-b' | ||
]; | ||
} |