-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
social icons and better author links (#1375)
* Change Author links to an Array This just loosely adapts the new schema to the existing template. - Changed all author content files - Updated schema - Removed some dead data imports Cherry-picked from the author page branch * Add example content to work off of * Enable viewboxes in SVGR components This is next to no data (a few bytes per SVG max) and allows SVGR-based components to be resized via CSS. * Make Twitter icon color-neutral Also update its current usage in the hamburger menu so it looks the same despite the change. * Overhaul Author Link schema Author Links are now objects with a sort of subtype defined by their `site` field. The node parser recognizes certain strings provided to the `links` field and converts them to these objects pre-filled with the correct info (right now it's Twitter, LinkedIn, and GitHub). These objects can then be queried all throughout the site, whether it be for social icons or a more detailed list. Also worth noting that since `links` is an array, its order is maintained. * Adapt FeedMeta to links and add a SocialIcon component * Improve TS fix and move SocialIcon SVGs * Remake string link processors The string processors now have their own file with an object that links hostname strings to processor functions that take a specific set of URL info gathered via regex and return an object describing Author link represented by the string. Now they're made of re-usable functional blocks, allowing for quick additions to recognize other site types. This allows us to easily re-use common patterns like "the username is the pathname with slashes stripped" while also being flexible enough to accomodate any special case, as there will always be exceptions. There's also tests for the new link parser. * Combine link parser into one file It can always be split later if additions make it cumbersome. * Embed processStringLink and move WrongTypeError closer to where it's used. * Improve LinkedIn handling Change urls to include `www.` like canonical, and make it not a function chain since we handle everything differently. * Embed and simplify trimSlashes and fix LinkedIn test
- Loading branch information
1 parent
845d7b5
commit 6007482
Showing
24 changed files
with
358 additions
and
42 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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
--- | ||
name: Elle O'Brien | ||
avatar: elle_obrien.jpg | ||
link: https://twitter.com/andronovhopf | ||
links: | ||
- https://twitter.com/andronovhopf | ||
--- | ||
|
||
Data scientist at [http://dvc.org](http://dvc.org) |
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
--- | ||
name: Jorge Orpinel Pérez | ||
avatar: jorge.jpg | ||
link: https://www.linkedin.com/in/jorgeorpinel | ||
links: | ||
- https://www.linkedin.com/in/jorgeorpinel | ||
--- | ||
|
||
Technical writer and developer at [dvc.org](http://dvc.org/) |
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
--- | ||
name: Marija Ilić | ||
avatar: marija_ilic.png | ||
link: https://www.linkedin.com/in/marija-ili%C4%87-65b8a53 | ||
links: | ||
- https://www.linkedin.com/in/marija-ili%C4%87-65b8a53 | ||
--- | ||
|
||
Data scientist at Njuškalo, Croatia. |
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
--- | ||
name: Svetlana Grinchenko | ||
avatar: svetlana_grinchenko.jpeg | ||
link: https://twitter.com/a142hr | ||
links: | ||
- https://twitter.com/a142hr | ||
--- | ||
|
||
Head of developer relations at [http://dvc.org](http://dvc.org) |
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
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
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
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 |
---|---|---|
|
@@ -106,6 +106,7 @@ | |
.subSectionLinkImage { | ||
display: block; | ||
margin: 0 auto 5px; | ||
color: #fff; | ||
} | ||
|
||
.subSectionLinkTitle { | ||
|
File renamed without changes
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,43 @@ | ||
import React from 'react' | ||
import Link from '../Link' | ||
import { ReactComponent as TwitterIcon } from './twitter.svg' | ||
import { ReactComponent as GithubIcon } from './github.svg' | ||
import { ReactComponent as LinkedInIcon } from './linkedin.svg' | ||
|
||
const icons: { [site: string]: JSX.Element } = { | ||
linkedin: <LinkedInIcon />, | ||
github: <GithubIcon />, | ||
twitter: <TwitterIcon viewBox="5 5 30 30" /> | ||
} | ||
|
||
export interface ISocialIcon { | ||
url: string | ||
site?: string | ||
} | ||
|
||
export interface ISocialIconProps extends ISocialIcon { | ||
className?: string | ||
} | ||
|
||
/* | ||
Returns a link containing an icon corresponding to the provided site | ||
Given the situation where either the given link has no site or we don't have | ||
an icon for it, we return null such that nothing is rendered in map | ||
functions. | ||
*/ | ||
const SocialIcon: React.FC<ISocialIconProps> = ({ | ||
site, | ||
url, | ||
className | ||
}): JSX.Element | null => { | ||
/* eslint-disable-next-line */ | ||
const icon: JSX.Element = icons[site!] | ||
return icon ? ( | ||
<Link href={url} className={className} aria-label={site}> | ||
{icon} | ||
</Link> | ||
) : null | ||
} | ||
|
||
export default SocialIcon |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.