- Notifications
You must be signed in to change notification settings - Fork1k
refactor: Update users page to looks like others#1850
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Story } from "@storybook/react" | ||
import React from "react" | ||
import { AvatarData, AvatarDataProps } from "./AvatarData" | ||
export default { | ||
title: "components/AvatarData", | ||
component: AvatarData, | ||
} | ||
const Template: Story<AvatarDataProps> = (args: AvatarDataProps) => <AvatarData {...args} /> | ||
export const Example = Template.bind({}) | ||
Example.args = { | ||
title: "coder", | ||
subtitle: "coder@coder.com", | ||
} | ||
export const WithLink = Template.bind({}) | ||
WithLink.args = { | ||
title: "coder", | ||
subtitle: "coder@coder.com", | ||
link: "/users/coder", | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
importAvatarfrom"@material-ui/core/Avatar" | ||
importLinkfrom"@material-ui/core/Link" | ||
import{makeStyles}from"@material-ui/core/styles" | ||
importReactfrom"react" | ||
import{LinkasRouterLink}from"react-router-dom" | ||
import{combineClasses}from"../../util/combineClasses" | ||
import{firstLetter}from"../../util/firstLetter" | ||
exportinterfaceAvatarDataProps{ | ||
title:string | ||
subtitle:string | ||
link?:string | ||
} | ||
exportconstAvatarData:React.FC<AvatarDataProps>=({ title, subtitle, link})=>{ | ||
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. I didn't find a better name for it 😓 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. Seems fine! | ||
conststyles=useStyles() | ||
return( | ||
<divclassName={styles.root}> | ||
<Avatarvariant="square"className={styles.avatar}> | ||
{firstLetter(title)} | ||
</Avatar> | ||
{link ?( | ||
<Linkcomponent={RouterLink}to={link}className={combineClasses([styles.info,styles.link])}> | ||
<b>{title}</b> | ||
<span>{subtitle}</span> | ||
</Link> | ||
) :( | ||
<divclassName={styles.info}> | ||
<b>{title}</b> | ||
<span>{subtitle}</span> | ||
</div> | ||
)} | ||
</div> | ||
) | ||
} | ||
constuseStyles=makeStyles((theme)=>({ | ||
root:{ | ||
display:"flex", | ||
alignItems:"center", | ||
}, | ||
avatar:{ | ||
borderRadius:2, | ||
marginRight:theme.spacing(1), | ||
width:24, | ||
height:24, | ||
fontSize:16, | ||
}, | ||
info:{ | ||
display:"flex", | ||
flexDirection:"column", | ||
color:theme.palette.text.primary, | ||
"& span":{ | ||
fontSize:12, | ||
color:theme.palette.text.secondary, | ||
}, | ||
}, | ||
link:{ | ||
textDecoration:"none", | ||
"&:hover":{ | ||
textDecoration:"underline", | ||
}, | ||
}, | ||
})) |
This file was deleted.
Uh oh!
There was an error while loading.Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading.Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading.Please reload this page.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -55,5 +55,10 @@ const useStyles = makeStyles((theme: Theme) => ({ | ||
// Set a fixed width for the select. It avoids selects having different sizes | ||
// depending on how many roles they have selected. | ||
width: theme.spacing(25), | ||
"& .MuiSelect-root": { | ||
// Adjusting padding because it does not have label | ||
paddingTop: theme.spacing(1.5), | ||
paddingBottom: theme.spacing(1.5), | ||
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. Added these because the select when there is no label is very BIG. | ||
}, | ||
}, | ||
})) |
Uh oh!
There was an error while loading.Please reload this page.