Skip to content

Commit

Permalink
simplify parameters Bio
Browse files Browse the repository at this point in the history
  • Loading branch information
tmanundercover committed Dec 18, 2023
1 parent 2c90f9b commit 94af2e2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/components/pdf-renderer/ResumeDocumentPDF.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import RalewayFont from "../../fonts/raleway/static/Raleway-Regular.ttf"
import CustomizedThemeContext from "../customized-theme-provider/CustomizedThemeContext";
import dateUtils from "../../utils/dateUtils";
import {COLORS} from "../../theme/common/ColorPalette";
import {SanityTransformHwHomePage} from "../../common/sanityIo/Types";


Font.register({family: 'Raleway', src: RalewayFont, fontStyle: 'normal', fontWeight: 'normal'});
Expand All @@ -22,8 +23,7 @@ Font.register({family: 'Raleway', src: RalewayFont, fontStyle: 'normal', fontWei


interface IProps {
content?: any
homePage?: SanityHomePage
homePage?: SanityTransformHwHomePage
}

const PDF_COLORS = {
Expand Down Expand Up @@ -101,7 +101,7 @@ const ResumeDocumentPDF: FunctionComponent<IProps> = (props: IProps) => {

return (<Document>
<Page size="A4" style={styles.page}>
{props?.content?.map((columnLayoutContainer: any, index: number) => {
{props?.homePage?.pageContent.content?.map((columnLayoutContainer: any, index: number) => {
switch (columnLayoutContainer._type) {
case 'ResumeBioSection':
const resumeBioSection: ResumeBioSectionType = columnLayoutContainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {Close} from "@mui/icons-material";

interface IProps {
sectionData: ResumeBioSectionType
content: any
homePage?: SanityTransformHwHomePage
isHideEmail?: boolean
isHideButtons?:boolean
Expand Down Expand Up @@ -95,8 +94,7 @@ const ResumeBioSection: FunctionComponent<IProps> = (props: IProps) => {
href={props.homePage?.bookAppointmentLink}><Typography variant="button" align='center'>Meet
with Me</Typography></Button>
<Button name={'contact-me'} variant='contained' fullWidth color='primary'
href={'#CONTACT_ME'}><Typography variant="button" align='center'>Contact
Me</Typography></Button>
href={'#CONTACT_ME'}><Typography variant="button" align='center'>{props.sectionData.contactMeButtonTitle}</Typography></Button>
<Button
name={'download-resume'}
onClick={
Expand All @@ -107,7 +105,7 @@ const ResumeBioSection: FunctionComponent<IProps> = (props: IProps) => {
// href={props.sectionData.resumeFile?.url + "?dl=James Terrell Singleton - Software Engineer - Resume.pdf"}
variant='contained' fullWidth color='primary'><Typography variant="button" align='center'
noWrap>
Download Resume</Typography></Button>
{props.sectionData.resumeFileDownloadText}</Typography></Button>
{/*{props.sectionData.cvFile && props.sectionData.cvFile.url.length > 0 && <Button*/}
{/* href={props.sectionData.cvFile?.url + "?dl=James Terrell Singleton - Software Engineer - CV.pdf"}*/}
{/* variant='contained' fullWidth color='primary'><CloudDownload*/}
Expand All @@ -118,8 +116,8 @@ const ResumeBioSection: FunctionComponent<IProps> = (props: IProps) => {
</Grid>}
<Modal open={isPDFResumeOpen}>
<><IconButton onClick={()=>{setIsPDFResumeOpen(false)}}><Close htmlColor={"#FFFFFF"} /></IconButton>
<PDFViewer width={"100%"} height={"90%"}>
<ResumeDocumentPDF content={props.content} homePage={props.homePage} />
<PDFViewer width="100%" height="90%">
<ResumeDocumentPDF homePage={props.homePage} />
</PDFViewer>
</>
</Modal>
Expand Down
10 changes: 5 additions & 5 deletions src/stories/digital-resume/ResumeBio.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import CustomizedThemeProvider from "../../components/customized-theme-provider/
import DigitalResumeThemeData from "../data/DigitalResumeThemeData";
import calculatedHomePageResumeData from "../data/CalculatedHomePageData";
import getThemeFromSanity from "../../components/customized-theme-provider/getThemeFromSanity";
import homePageData from "../data/HomePageData";

const meta: Meta<typeof ResumeBioSection> = {
title:"Resume/Section/Resume Bio Section",
Expand All @@ -24,25 +25,24 @@ type Story = StoryObj<typeof ResumeBioSection>;
* to learn how to use render functions.
*/

const buttonText = "Button Text"
export const ResumeBioSectionComplete: Story = {
args :{
sectionData: ResumeBioSectionData,
homePage: homePageResumeData
homePage: homePageResumeData,
},
render: ({sectionData, isHideEmail, isHideButtons, homePage}) =>
<ThemeProvider theme={getThemeFromSanity(DigitalResumeThemeData)}>
<ResumeBioSection isHideButtons={isHideButtons} isHideEmail={isHideEmail} sectionData={sectionData} homePage={calculatedHomePageResumeData(WebDevThemeData)}></ResumeBioSection>
<ResumeBioSection isHideButtons={isHideButtons} isHideEmail={isHideEmail} sectionData={sectionData} homePage={homePage}></ResumeBioSection>
</ThemeProvider> ,
};

export const ResumeBioSectionSearchResult: Story = {
args :{
sectionData: ResumeBioSectionData,
homePage: homePageResumeData
homePage: homePageResumeData,
},
render: ({sectionData, isHideEmail, isHideButtons, homePage}) =>
<ThemeProvider theme={getThemeFromSanity(DigitalResumeThemeData)}>
<ResumeBioSection isHideButtons={true} isHideEmail={true} sectionData={sectionData} homePage={calculatedHomePageResumeData(WebDevThemeData)}></ResumeBioSection>
<ResumeBioSection isHideButtons={true} isHideEmail={true} sectionData={sectionData} homePage={homePage}></ResumeBioSection>
</ThemeProvider> ,
};
7 changes: 4 additions & 3 deletions src/utils/dateUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,22 @@ const getLengthOfTime = (date1: Date, date2: Date) =>{
months_passed+=1;
if(months_passed >= 13) {
years_passed += 1;
months_passed -= 1;
}
}

//Set up custom text
const yrsTxt = ["year", "years"];
const mnthsTxt = ["month", "months"];
const daysTxt = ["day", "days"];
// const daysTxt = ["day", "days"];

//Convert to days and sum together
const total_days = (years_passed * 365) + (months_passed * 30.417) + days_passed;

//display result with custom text
const result = ((years_passed == 1) ? years_passed + ' ' + yrsTxt[0] + ' ' : (years_passed > 1) ?
const result = ((years_passed === 1) ? years_passed + ' ' + yrsTxt[0] + ' ' : (years_passed > 1) ?
years_passed + ' ' + yrsTxt[1] + ' ' : '') +
((months_passed == 1) ? months_passed + ' ' + mnthsTxt[0] : (months_passed > 1) ?
((months_passed === 1) ? months_passed + ' ' + mnthsTxt[0] : (months_passed > 1) ?
months_passed + ' ' + mnthsTxt[1] + ' ' : '')
// ((days_passed == 1) ? days_passed + ' ' + daysTxt[0] : (days_passed > 1) ?
// days_passed + ' ' + daysTxt[1] : '')
Expand Down

0 comments on commit 94af2e2

Please sign in to comment.