-
-
Notifications
You must be signed in to change notification settings - Fork 473
feat(platform): add color toggle to follow button on research page #2205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3e55db8
12d1bf2
b1304d9
cfed652
3d39ad2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| export const commonColors = { | ||
| white: 'white', | ||
| offwhite: '#ececec', | ||
| black: '#1b1b1b', | ||
| softyellow: '#f5ede2', | ||
| blue: '#83ceeb', | ||
| red: '#eb1b1f', | ||
| red2: '#f58d8e', | ||
| softblue: '#e2edf7', | ||
| bluetag: '#5683b0', | ||
| grey: '#61646b', | ||
| green: '#00c3a9', | ||
| error: 'red', | ||
| background: '#f4f6f7', | ||
| silver: '#c0c0c0', | ||
| softgrey: '#c2d4e4', | ||
| lightgrey: '#ababac', | ||
| darkGrey: '#686868', | ||
| subscribed: 'orange', | ||
| 'not-subscribed': '#1b1b1b', | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| /** @jsxImportSource theme-ui */ | ||
| import { useTheme } from '@emotion/react' | ||
| import { format } from 'date-fns' | ||
| import { | ||
| Button, | ||
|
|
@@ -14,9 +16,6 @@ import { isUserVerified } from 'src/common/isUserVerified' | |
| import type { IResearch } from 'src/models/research.models' | ||
| import type { IUser } from 'src/models/user.models' | ||
| import { useResearchStore } from 'src/stores/Research/research.store' | ||
| // TODO: Remove direct usage of Theme | ||
| import { preciousPlasticTheme } from 'oa-themes' | ||
| const theme = preciousPlasticTheme.styles | ||
| import { | ||
| addIDToSessionStorageArray, | ||
| retrieveSessionStorageArray, | ||
|
|
@@ -48,6 +47,7 @@ const ResearchDescription = ({ research, isEditable, ...props }: IProps) => { | |
| let didInit = false | ||
| const store = useResearchStore() | ||
| const [viewCount, setViewCount] = useState<number | undefined>() | ||
| const theme = useTheme() | ||
|
|
||
| const incrementViewCount = async () => { | ||
| const sessionStorageArray = retrieveSessionStorageArray('research') | ||
|
|
@@ -110,14 +110,19 @@ const ResearchDescription = ({ research, isEditable, ...props }: IProps) => { | |
| <Button | ||
| icon="thunderbolt" | ||
| variant="outline" | ||
| iconColor={ | ||
| research.subscribers?.includes( | ||
| props?.loggedInUser?.userName || '', | ||
| ) | ||
AlfonsoGhislieri marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ? theme.colors.subscribed | ||
| : theme.colors['not-subscribed'] | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue: Would be a lot cleaner to not have these colors hardcoded, would be nicer to add them to the theme/use the theme instead (eg: subscribed: 'orange', not-subscribed: 'black'). You can find the theme files in packages/themes/src. Let me know if you have any questions or need any help for this. BUT, if this is too much extra work and you don't have time I'm happy to approve this and add it to my TODO.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| sx={{ | ||
| fontSize: 2, | ||
| py: 0, | ||
| height: '41.5px', // TODO: Ideally this is a standard size | ||
| }} | ||
| onClick={() => { | ||
| props.onFollowingClick() | ||
| }} | ||
| onClick={props.onFollowingClick} | ||
| > | ||
| {research.subscribers?.includes( | ||
| props?.loggedInUser?.userName || '', | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion following issue above: here you should use sx to so that you can access the theme colors directly. Eg:
<Icon glyph={props.icon} sx={{ color: props.iconColor }} />There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to add
sxto theIconWrapperComponent directly, as it uses styled components, which didn't seem to work well with the theming I had defined.