diff --git a/frontend/.env b/frontend/.env index 03b2813..ba18e02 100644 --- a/frontend/.env +++ b/frontend/.env @@ -1 +1 @@ -REACT_APP_BASE_API_URL=http://52.204.195.181:8000/api/v1/jobs \ No newline at end of file +REACT_APP_BASE_API_URL=https://jobhopper.aballslab.com/api/v1/jobs diff --git a/frontend/src/ui/LandingBlurb.stories.tsx b/frontend/src/ui/LandingBlurb/LandingBlurb.stories.tsx similarity index 63% rename from frontend/src/ui/LandingBlurb.stories.tsx rename to frontend/src/ui/LandingBlurb/LandingBlurb.stories.tsx index e46d1fd..2582dce 100644 --- a/frontend/src/ui/LandingBlurb.stories.tsx +++ b/frontend/src/ui/LandingBlurb/LandingBlurb.stories.tsx @@ -2,13 +2,13 @@ import React from 'react'; // also exported from '@storybook/react' if you can deal with breaking changes in 6.1 import { Story, Meta } from '@storybook/react/types-6-0'; -import LandingBlurb from './LandingBlurb'; +import { LandingBlurbContainer } from './LandingBlurbContainer'; export default { title: 'JobHopper/LandingBlurb', - component: LandingBlurb, + component: LandingBlurbContainer, } as Meta; -const Template: Story = () => ; +const Template: Story = () => ; export const Default = Template.bind({}); diff --git a/frontend/src/ui/LandingBlurb.tsx b/frontend/src/ui/LandingBlurb/LandingBlurbContainer.tsx similarity index 65% rename from frontend/src/ui/LandingBlurb.tsx rename to frontend/src/ui/LandingBlurb/LandingBlurbContainer.tsx index 7f55f93..ebe8762 100644 --- a/frontend/src/ui/LandingBlurb.tsx +++ b/frontend/src/ui/LandingBlurb/LandingBlurbContainer.tsx @@ -2,10 +2,30 @@ import { Collapse } from '@material-ui/core'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import React, { useState } from 'react'; import styled from 'styled-components'; -import { Section } from './Common'; -import { Body, Title } from './Typography'; +import { Section } from '../Common'; +import { Body, Title } from '../Typography'; +import { useEffect } from 'react'; +import { useOccupationsState } from '../../ducks/occupations'; -const CollapsingSection = styled(Section)` + +export const LandingBlurbContainer = () => { + const [show, setShow] = useState(true); + const [hasClicked, setHasClicked] = useState(false); + const {selectedOccupation} = useOccupationsState(); + + useEffect(() => { + if (selectedOccupation && show && !hasClicked) { + setShow(false); + } + }) + + return { + setShow(show => !show); + setHasClicked(true); + }}/>; +} + + const CollapsingSection = styled(Section)` & p { margin-block: 0; margin-bottom: 48px; @@ -16,7 +36,7 @@ const CollapseIcon = styled(ExpandMoreIcon)` vertical-align: middle; `; -export default function LandingBlurb() { +export default function LandingBlurbCN() { const [show, setShow] = useState(true); return ( diff --git a/frontend/src/ui/LandingBlurb/index.ts b/frontend/src/ui/LandingBlurb/index.ts new file mode 100644 index 0000000..07ced35 --- /dev/null +++ b/frontend/src/ui/LandingBlurb/index.ts @@ -0,0 +1 @@ +export { LandingBlurbContainer } from './LandingBlurbContainer'; diff --git a/frontend/src/ui/TransitionPage/TransitionPage.tsx b/frontend/src/ui/TransitionPage/TransitionPage.tsx index 5ae003d..7833ec5 100644 --- a/frontend/src/ui/TransitionPage/TransitionPage.tsx +++ b/frontend/src/ui/TransitionPage/TransitionPage.tsx @@ -2,13 +2,15 @@ import React from 'react'; import { LabeledSection } from '../Common'; import Page from '../Page'; import { ResultsContainer } from '../Results'; -import LandingBlurb from '../LandingBlurb'; +import { LandingBlurbContainer } from '../LandingBlurb'; import { OccupationSelectContainer, StateSelectContainer } from '../Select'; import { createContainerContext } from '../utils'; + const { ContainerContext, useContainerContext } = createContainerContext({ OccupationSelectContainer, StateSelectContainer, + ResultsContainer, }); @@ -20,7 +22,7 @@ const TransitionPage: React.FC = () => { } = useContainerContext(); return ( - +