This repository has been archived by the owner on Aug 29, 2024. It is now read-only.
-
-
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.
feat: added author card to strats page
- Loading branch information
1 parent
d5b60c1
commit 071d29f
Showing
17 changed files
with
470 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Author } from '../src/types/author'; | ||
import { Strat } from '../src/types/strat'; | ||
|
||
export function mockStrat(overrides?: Partial<Strat>): Strat { | ||
return { | ||
id: '1234', | ||
name: 'Strats for Stratty things!', | ||
author: mockAuthor(), | ||
...overrides | ||
}; | ||
} | ||
|
||
export function mockAuthor(overrides?: Partial<Author>): Author { | ||
return { | ||
uid: 'marcy', | ||
name: 'Marcy', | ||
image: 'https://avatars.githubusercontent.com/u/9692284?v=4', | ||
pronouns: ['she/her', 'they/them'], | ||
...overrides | ||
}; | ||
} |
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 { mockAuthor } from './mocks'; | ||
|
||
export const authors = { | ||
ceci: mockAuthor({ | ||
uid: 'ceci', | ||
name: 'Ceci', | ||
image: 'https://avatars.githubusercontent.com/u/9692284?v=4', | ||
pronouns: ['she/hers', 'they/them'] | ||
}), | ||
clover: mockAuthor({ | ||
uid: 'clover', | ||
name: 'Clover', | ||
image: 'https://i.imgur.com/WKXMkzY.png', | ||
pronouns: ['she/her', 'they/them', 'he/him'] | ||
}), | ||
mumu: mockAuthor({ | ||
uid: 'mumu', | ||
name: 'Mumu', | ||
image: 'https://i.imgur.com/I4bUHxt.png', | ||
pronouns: ['they/them'] | ||
}) | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
.avatar { | ||
position: relative; | ||
border-radius: 50%; | ||
overflow: hidden; | ||
aspect-ratio: 1/1; | ||
min-width: 40px; | ||
user-select: none; | ||
} |
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,30 @@ | ||
import { useReadOnlyCachedState } from '../hooks/use-cached-state'; | ||
import styles from './Avatar.module.scss'; | ||
|
||
export type PronounsProps = { | ||
pronouns: string[]; | ||
} | ||
|
||
export function Pronouns({ | ||
pronouns: externalPronouns | ||
}: PronounsProps): JSX.Element { | ||
const pronouns = useReadOnlyCachedState(() => { | ||
let formattedPronouns: string[]; | ||
if (externalPronouns.length === 1) { | ||
formattedPronouns = externalPronouns[0].split('/'); | ||
} else { | ||
formattedPronouns = externalPronouns.reduce((output, pronoun) => { | ||
output.push(pronoun.split('/')[0]) | ||
return output; | ||
}, []); | ||
} | ||
|
||
return formattedPronouns.join(' / '); | ||
}, [externalPronouns]); | ||
|
||
return ( | ||
<div className={styles.pronouns}> | ||
{pronouns} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.typography { | ||
line-height: 1; | ||
} | ||
|
||
.h1 { | ||
font-weight: normal; | ||
margin: 0; | ||
font-size: 50px; | ||
} |
Oops, something went wrong.