forked from AOEpeople/aoe_technology_radar
-
Notifications
You must be signed in to change notification settings - Fork 0
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
61d46f9
commit c0dd180
Showing
8 changed files
with
183 additions
and
74 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
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,22 @@ | ||
import React from 'react'; | ||
import classNames from 'classnames'; | ||
|
||
|
||
export default function Badge({ onClick, big, type, children }) { | ||
const Comp = typeof onClick === 'function' ? 'a' : 'span'; | ||
return ( | ||
<Comp | ||
className={classNames( | ||
'badge', | ||
`badge--${type}`, | ||
{ | ||
'badge--big': big === true, | ||
} | ||
)} | ||
onClick={onClick} | ||
href={Comp === 'a' ? '#' : undefined} | ||
> | ||
{children} | ||
</Comp> | ||
); | ||
} |
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,20 @@ | ||
import React from 'react'; | ||
import classNames from 'classnames'; | ||
|
||
export default function Item({ item, noLeadingBorder = false}) { | ||
return ( | ||
<a | ||
className={classNames('item', { | ||
'item--no-leading-border': noLeadingBorder, | ||
})} | ||
href={`/${item.quadrant}/${item.name}.html`} | ||
> | ||
<div className="item__title">{item.title}</div> | ||
{ | ||
item.info && ( | ||
<div className="item__info">{item.info}</div> | ||
) | ||
} | ||
</a> | ||
); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
import HeroHeadline from './HeroHeadline'; | ||
import HeadlineGroup from './HeadlineGroup'; | ||
import QuadrantSection from './QuadrantSection'; | ||
import { translate } from '../../common/config'; | ||
import { groupByQuadrants } from '../../common/model'; | ||
|
||
export default function PageQuadrant({ pageName, items }) { | ||
const groups = groupByQuadrants(items); | ||
return ( | ||
<div> | ||
<HeadlineGroup> | ||
<HeroHeadline>{translate(pageName)}</HeroHeadline> | ||
</HeadlineGroup> | ||
<QuadrantSection groups={groups} quadrantName={pageName} big /> | ||
</div> | ||
); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import React from 'react'; | ||
import { translate, rings } from '../../common/config'; | ||
import Badge from './Badge'; | ||
import Item from './Item'; | ||
|
||
const renderList = (ringName, quadrantName, groups, big) => { | ||
const itemsInRing = groups[quadrantName][ringName]; | ||
|
||
if (big === true) { | ||
return ( | ||
<div className="item-list"> | ||
<div className="item-list__header"> | ||
<Badge type={ringName} big={big}>{ringName}</Badge> | ||
</div> | ||
<div className="item-list__list"> | ||
{ | ||
itemsInRing.map(item => ( | ||
<Item key={item.name} item={item} noLeadingBorder /> | ||
)) | ||
} | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div className="ring-list"> | ||
<div className="ring-list__header"> | ||
<Badge type={ringName}>{ringName}</Badge> | ||
</div> | ||
{ | ||
itemsInRing.map(item => ( | ||
<span | ||
key={item.name} | ||
className="ring-list__item" | ||
> | ||
<a className="link" href={`/${item.quadrant}/${item.name}.html`}>{item.title}</a> | ||
</span> | ||
)) | ||
} | ||
</div> | ||
); | ||
} | ||
|
||
|
||
const renderRing = (ringName, quadrantName, groups, big) => { | ||
if (!groups[quadrantName][ringName] || groups[quadrantName][ringName].length === 0) { | ||
return null; | ||
} | ||
return ( | ||
<div key={ringName} className="quadrant-section__ring"> | ||
{renderList(ringName, quadrantName, groups, big)} | ||
</div> | ||
); | ||
} | ||
|
||
export default function QuadrantSection({ quadrantName, groups, big = false }) { | ||
return ( | ||
<div className="quadrant-section"> | ||
<div className="quadrant-section__header"> | ||
<div className="split"> | ||
<div className="split__left"> | ||
<h4 className="headline">{translate(quadrantName)}</h4> | ||
</div> | ||
{ | ||
!big && ( | ||
<div className="split__right"> | ||
<a className="icon-link" href={`/${quadrantName}.html`}> | ||
<span className="icon icon--pie icon-link__icon"></span>Quadrant Overview | ||
</a> | ||
</div> | ||
) | ||
} | ||
</div> | ||
</div> | ||
<div className="quadrant-section__rings"> | ||
{ | ||
rings.map((ringName) => renderRing(ringName, quadrantName, groups, big)) | ||
} | ||
</div> | ||
</div> | ||
); | ||
} |
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