Thanks to visit codestin.com
Credit goes to github.com

Skip to content

refactor(site): generalize UserCell component #484

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

Merged
merged 7 commits into from
Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! reorder type
  • Loading branch information
greyscaled committed Mar 23, 2022
commit ec4ac6d82c56748a1fc887baf6651a29bdd4379d
22 changes: 15 additions & 7 deletions site/src/components/Table/Cells/UserCell.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,28 @@ import { UserCell, UserCellProps } from "./UserCell"
export default {
title: "Table/Cells/UserCell",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@presleyp - do you like this organization (Table > Cells) ? Another possibility is a new directory "TableCells". I could go either way, just wanna find the one we all think is best.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this seems good! Having a manageable number of top level categories will be nice.

component: UserCell,
argTypes: {
onPrimaryTextSelect: {
action: "onPrimaryTextSelect",
},
},
} as ComponentMeta<typeof UserCell>

const Template: Story<UserCellProps> = (args) => <UserCell {...args} />

export const Example = Template.bind({})
Example.args = {
export const AuditLogExample = Template.bind({})
AuditLogExample.args = {
Avatar: {
username: MockUser.username,
},
caption: MockUserAgent.ip_address,
primaryText: MockUser.email,
onPrimaryTextSelect: () => {
return
},
}

export const AuditLogEmptyUserExample = Template.bind({})
AuditLogEmptyUserExample.args = {
Avatar: {
username: MockUser.username,
},
caption: MockUserAgent.ip_address,
primaryText: "Deleted User",
onPrimaryTextSelect: undefined,
}
5 changes: 2 additions & 3 deletions site/src/components/Table/Cells/UserCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface UserCellProps {
const useStyles = makeStyles((theme) => ({
primaryText: {
color: theme.palette.text.primary,
fontFamily: theme.typography.fontFamily,
fontSize: "16px",
lineHeight: "15px",
marginBottom: "5px",
Expand All @@ -49,9 +50,7 @@ export const UserCell: React.FC<UserCellProps> = ({ Avatar, caption, primaryText
{primaryText}
</Link>
) : (
<Typography className={styles.primaryText} color="textSecondary">
{primaryText}
</Typography>
<Typography className={styles.primaryText}>{primaryText}</Typography>
)}

{caption && (
Expand Down