Skip to content

Commit

Permalink
Merge pull request #1886 from ResearchHub/smallfixes2
Browse files Browse the repository at this point in the history
journal-carousel item & fixed icons on left sidebar
  • Loading branch information
TylerDiorio authored Nov 20, 2024
2 parents c96dea4 + b6e3263 commit 2267936
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 15 deletions.
2 changes: 1 addition & 1 deletion components/Home/sidebar/HomeRightSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function HomeRightSidebar(): ReactElement {
isDismissed: isCarouselDismissed,
dismissFeature: dismissCarousel,
dismissStatus: carouselDismissStatus,
} = useDismissableFeature({ auth, featureName: "educational-carousel" });
} = useDismissableFeature({ auth, featureName: "educational-carousel-with-journal" });

return (
<div className={css(styles.HomeRightSidebar)}>
Expand Down
17 changes: 14 additions & 3 deletions components/Home/sidebar/RootLeftSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -701,10 +701,15 @@ const styles = StyleSheet.create({
padding: "8px 30px",
justifyContent: "flex-start",
width: "100%",
flexWrap: "wrap",
gap: "12px",

},
leftSidebarFooterItemsBottomRowMin: {
justifyContent: "center",
padding: "8px 0",
flexDirection: "column",
gap: "8px",
},
leftSidebarFooterTxtItemMobile: {
fontSize: 14,
Expand All @@ -726,14 +731,20 @@ const styles = StyleSheet.create({
fontSize: 18,
marginRight: 20,
display: "block",
"@media only screen and (max-width: 1023px)": {
marginRight: 0,
},
},
leftSidebarFooterBotItem: {
color: colors.TEXT_GREY(1),
fontSize: 14,
marginRight: 14,
fontSize: 13,
marginRight: 0,
":hover": {
color: colors.TEXT_GREY(1),
},
"@media only screen and (max-width: 1023px)": {
marginRight: 0,
},
},
logoDiv: {
display: "flex",
Expand Down Expand Up @@ -847,4 +858,4 @@ const mapStateToProps = (state) => ({
currentUser: state.auth.user,
});

export default connect(mapStateToProps, mapDispatchToProps)(RootLeftSidebar);
export default connect(mapStateToProps, mapDispatchToProps)(RootLeftSidebar);
46 changes: 35 additions & 11 deletions components/Home/sidebar/UnifiedCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faChevronLeft, faChevronRight } from "@fortawesome/pro-light-svg-icons";
import { CloseIcon } from "~/config/themes/icons";
import { DEFAULT_ITEM_STYLE } from "~/components/shared/carousel/RhCarouselItem";
import { getJournalCarouselElements } from "~/components/ResearchHubJournal/RhJournalCarouselElement";
import { getVerificationCarouselElements } from "~/components/Verification/VerificationCarouselElement";
import colors from "~/config/themes/colors";
import useCurrentUser from "~/config/hooks/useCurrentUser";
Expand All @@ -28,18 +29,17 @@ export default function UnifiedCarousel({
setError(null);

try {
const [educationalElements, peerReviewElements] = await Promise.all([
getEducationalCarouselElements(),
currentUser && !currentUser.isVerified ? getVerificationCarouselElements() : Promise.resolve([])
]);

const educationalElements = await getEducationalCarouselElements();
const verificationElements = await getVerificationCarouselElements();
const journalElements = getJournalCarouselElements();

const elements = [
...(currentUser ? peerReviewElements.map(element => ({
type: 'peer-review',
...(currentUser ? journalElements.map(element => ({
type: 'journal',
component: (
<div className={css(styles.slideWrapper, styles.peerReviewContainer)}>
<div className={css(styles.peerReviewBackground)} />
<div className={css(styles.peerReviewContent)}>
<div className={css(styles.slideWrapper, styles.journalContainer)}>
<div className={css(styles.journalBackground)} />
<div className={css(styles.journalContent)}>
<div className={css(styles.titleArea)}>
{element.title}
</div>
Expand Down Expand Up @@ -334,4 +334,28 @@ const styles = StyleSheet.create({
display: 'flex',
flexDirection: 'column',
},
});
journalContainer: {
position: 'relative',
height: '100%',
display: 'flex',
flexDirection: 'column',
padding: "24px 32px 48px 32px",
},
journalBackground: {
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
background: colors.NEW_BLUE(),
opacity: 1,
zIndex: 1,
},
journalContent: {
position: 'relative',
zIndex: 2,
height: '100%',
display: 'flex',
flexDirection: 'column',
},
});
121 changes: 121 additions & 0 deletions components/ResearchHubJournal/RhJournalCarouselElement.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import { ReactElement } from "react";
import { StyleSheet, css } from "aphrodite";
import { DEFAULT_ITEM_STYLE } from "~/components/shared/carousel/RhCarouselItem";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faCheck } from "@fortawesome/free-solid-svg-icons";
import colors from "~/config/themes/colors";
import RhJournalIcon from "~/components/Icons/RhJournalIcon";
import Button from "../Form/Button";

export const getJournalCarouselElements = () => [{
title: (
<div className={css(DEFAULT_ITEM_STYLE.rhCarouselItemTitle)}>
<div className={css(styles.titleWrapper)}>
<div className={css(styles.avatarSection)}>
<RhJournalIcon width={40} height={40} color={colors.WHITE()} />
</div>
<span className={css(styles.titleText)}>ResearchHub Journal</span>
</div>
</div>
),
body: (
<div className={css(DEFAULT_ITEM_STYLE.rhCarouselItemBody)}>
<ul className={css(styles.bulletPoints)}>
<li className={css(styles.bulletPoint)}>
<FontAwesomeIcon
icon={faCheck}
className={css(styles.checkIcon)}
style={{ color: 'white' }}
/>
<span className={css(styles.listItemText)}>
14 days to peer reviews
</span>
</li>
<li className={css(styles.bulletPoint)}>
<FontAwesomeIcon
icon={faCheck}
className={css(styles.checkIcon)}
style={{ color: 'white' }}
/>
<span className={css(styles.listItemText)}>
Paid peer reviewers
</span>
</li>
<li className={css(styles.bulletPoint)}>
<FontAwesomeIcon
icon={faCheck}
className={css(styles.checkIcon)}
style={{ color: 'white' }}
/>
<span className={css(styles.listItemText)}>
Open access by default
</span>
</li>
</ul>
<div className={css(styles.ctaWrapper)}>
<Button
fullWidth
type="primary"
variant="outlined"
size="med"
onClick={() => window.open('./researchhub-journal', '_self')}
>
Learn more
</Button>
</div>
</div>
)
}];

const styles = StyleSheet.create({
titleWrapper: {
display: 'flex',
alignItems: 'center',
gap: 16,
marginLeft: -8,
},
titleText: {
marginTop: 4,
fontSize: 20,
fontWeight: 500,
letterSpacing: '0.25px',
color: colors.WHITE(1),
},
avatarSection: {
position: 'relative',
width: 50,
height: 50,
marginTop: -2,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
},
bulletPoints: {
listStyle: 'none',
padding: '0px 0px',
margin: '12px 0',
},
bulletPoint: {
display: 'flex',
alignItems: 'flex-start',
gap: 12,
marginBottom: 8,
},
checkIcon: {
width: 16,
height: 16,
marginTop: 4,
marginRight: 1,
color: 'white',
},
listItemText: {
color: 'white',
fontSize: 15,
lineHeight: '24px',
display: 'inline',
},
ctaWrapper: {
marginTop: 16,
width: '100%',
},
});

0 comments on commit 2267936

Please sign in to comment.