-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84f41ef
commit 5e50ecf
Showing
18 changed files
with
852 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
18 changes: 18 additions & 0 deletions
18
src/components/page-types/associatesDirectoryPage/associatesDirectory.js
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,18 @@ | ||
import React from 'react'; | ||
import SbEditable from 'storyblok-react'; | ||
import { Container } from '../../layout/Container'; | ||
import LegacyDirectory from './legacyDirectory/LegacyDirectory'; | ||
|
||
const AssociatesDirectory = (props) => { | ||
const { blok } = props; | ||
|
||
return ( | ||
<SbEditable content={blok}> | ||
<Container id="directory"> | ||
<LegacyDirectory /> | ||
</Container> | ||
</SbEditable> | ||
); | ||
}; | ||
|
||
export default AssociatesDirectory; |
46 changes: 46 additions & 0 deletions
46
src/components/page-types/associatesDirectoryPage/associatesDirectoryPage.js
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,46 @@ | ||
import React from 'react'; | ||
import SbEditable from 'storyblok-react'; | ||
import { dcnb } from 'cnbuilder'; | ||
import { Container } from '../../layout/Container'; | ||
import { Heading } from '../../simple/Heading'; | ||
import Layout from '../../partials/layout'; | ||
import hasRichText from '../../../utilities/hasRichText'; | ||
import RichTextRenderer from '../../../utilities/richTextRenderer'; | ||
import CreateBloks from '../../../utilities/createBloks'; | ||
|
||
const AssociatesDirectoryPage = (props) => { | ||
const { | ||
blok: { title, intro = {}, directory }, | ||
blok, | ||
} = props; | ||
|
||
return ( | ||
<SbEditable content={blok}> | ||
<Layout hasHero={false} {...props}> | ||
<Container as="main" id="main-content"> | ||
<header className="su-basefont-23"> | ||
<Container> | ||
<Heading align="center" font="serif" id="page-title"> | ||
{title} | ||
</Heading> | ||
</Container> | ||
</header> | ||
{hasRichText(intro) && ( | ||
<div className={dcnb('su-big-paragraph su-max-w-prose')}> | ||
<RichTextRenderer | ||
wysiwyg={intro} | ||
className="children:su-leading-display" | ||
/> | ||
</div> | ||
)} | ||
</Container> | ||
|
||
<Container className="basic-page su-relative su-flex-grow su-w-full"> | ||
<CreateBloks blokSection={directory} /> | ||
</Container> | ||
</Layout> | ||
</SbEditable> | ||
); | ||
}; | ||
|
||
export default AssociatesDirectoryPage; |
80 changes: 80 additions & 0 deletions
80
src/components/page-types/associatesDirectoryPage/legacyDirectory/LegacyDirectory.jsx
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,80 @@ | ||
/* eslint-disable*/ | ||
|
||
import React from 'react'; | ||
import axios from 'axios'; | ||
import keys from './keys.js'; | ||
import Counter from './counter/Counter.jsx'; | ||
//import Search from './search/Search.jsx'; | ||
import NameTabs from './nameTabs/NameTabs.jsx'; | ||
import './app.css'; | ||
|
||
class LegacyDirectory extends React.Component { | ||
constructor() { | ||
super(); | ||
|
||
this.state = {}; | ||
} | ||
|
||
componentDidMount() { | ||
console.log('keys', keys); | ||
|
||
const names = []; | ||
axios | ||
.get( | ||
`https://cdn.contentful.com/spaces/${keys.space}/entries?access_token=${keys.accessToken}&limit=1000&order=sys.id` | ||
) | ||
.then((response) => { | ||
response.data.items.forEach((person) => { | ||
names.push(person.fields); | ||
}); | ||
|
||
this.setState({ | ||
names, | ||
total: response.data.total, | ||
}); | ||
|
||
const loops = Math.ceil(response.data.total / 1000); | ||
let skip = 0; | ||
for (let i = 0; i < loops; i++) { | ||
skip += 1000; | ||
axios | ||
.get( | ||
`https://cdn.contentful.com/spaces/${keys.space}/entries?access_token=${keys.accessToken}&limit=1000&skip=${skip}&order=sys.id` | ||
) | ||
.then((response) => { | ||
let newNames = []; | ||
response.data.items.forEach((person) => { | ||
newNames.push(person.fields); | ||
}); | ||
let totalNames = this.state.names.concat(newNames); | ||
this.setState({ | ||
names: totalNames, | ||
}); | ||
}); | ||
} | ||
}) | ||
.catch((error) => { | ||
console.log(error); | ||
}); | ||
} | ||
|
||
render() { | ||
return ( | ||
<main> | ||
<header> | ||
<div id="associates--top-of-page" /> | ||
<Counter | ||
className="counter" | ||
count={this.state.names ? this.state.names.length : 0} | ||
/> | ||
{/* <Search className="search" names={this.state.names} /> */} | ||
</header> | ||
{this.state.names && this.state.names.length === this.state.total && ( | ||
<NameTabs names={this.state.names} /> | ||
)} | ||
</main> | ||
); | ||
} | ||
} | ||
|
||
export default LegacyDirectory; |
11 changes: 11 additions & 0 deletions
11
src/components/page-types/associatesDirectoryPage/legacyDirectory/app.css
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,11 @@ | ||
#su-associates main { | ||
margin-top: 2em; | ||
} | ||
|
||
#su-associates header { | ||
margin-left: 3%; | ||
} | ||
|
||
#su-associates .counter { | ||
margin-bottom: 1em; | ||
} |
9 changes: 9 additions & 0 deletions
9
src/components/page-types/associatesDirectoryPage/legacyDirectory/counter/Counter.jsx
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,9 @@ | ||
/* eslint-disable*/ | ||
|
||
import React from 'react'; | ||
|
||
const Counter = (props) => { | ||
return <div className="counter">{props.count} Associates Total</div>; | ||
}; | ||
|
||
export default Counter; |
7 changes: 7 additions & 0 deletions
7
src/components/page-types/associatesDirectoryPage/legacyDirectory/keys.js
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,7 @@ | ||
// It's not necessary to set these as environment variables because they are used on the client side. | ||
const keys = { | ||
space: '0f39zonxf59w', | ||
accessToken: '10OGNlSRGeKn81WAaTUxMjVL0nhXFEUszwRJIY7vPeI', | ||
}; | ||
|
||
export default keys; |
45 changes: 45 additions & 0 deletions
45
src/components/page-types/associatesDirectoryPage/legacyDirectory/letter/Letter.jsx
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,45 @@ | ||
/* eslint-disable*/ | ||
|
||
import React from 'react'; | ||
import './letter.css'; | ||
|
||
const Letter = (props) => { | ||
return ( | ||
<div> | ||
{props.names.map((person, index) => { | ||
let degrees = []; | ||
for (const key in person.years) { | ||
let degree; | ||
degree = person.years[key]; | ||
if (degree.slice(0, 2) !== 'AB' && degree.slice(0, 2) !== 'BS') { | ||
degrees.push( | ||
`${degree.slice(0, -4)} '${degree.substr(degree.length - 2)}` | ||
); | ||
} else { | ||
degrees.push(`'${degree.substring(5)}`); | ||
} | ||
} | ||
|
||
if (person.yearAdded === props.recentlyAdded) { | ||
return ( | ||
<div key={index}> | ||
<b> | ||
<div className="name">{`${person.entryTitle}`}</div> | ||
<div className="degrees">{`${degrees.join(', ')}`}</div> | ||
</b> | ||
</div> | ||
); | ||
} else { | ||
return ( | ||
<div key={index}> | ||
<div className="name">{`${person.entryTitle}`}</div> | ||
<div className="degrees">{`${degrees.join(', ')}`}</div> | ||
</div> | ||
); | ||
} | ||
})} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Letter; |
11 changes: 11 additions & 0 deletions
11
src/components/page-types/associatesDirectoryPage/legacyDirectory/letter/letter.css
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,11 @@ | ||
#su-associates .name { | ||
margin-left: 5%; | ||
padding: 0.3em 0; | ||
display: inline-block; | ||
width: 40%; | ||
} | ||
|
||
#su-associates .degrees { | ||
margin-left: 5%; | ||
display: inline; | ||
} |
Oops, something went wrong.