Download spectrum/src/components/message/authorByline.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.76 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/src/components/message/authorByline.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/src/components/message/authorByline.js
-
curl -L -o authorByline.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/src/components/message/authorByline.js
1.76 kB
| // @flow | |
| import * as React from 'react'; | |
| import { convertTimestampToTime } from 'shared/time-formatting'; | |
| import ConditionalWrap from 'src/components/conditionalWrap'; | |
| import { UserHoverProfile } from 'src/components/hoverProfile'; | |
| import { Link } from 'react-router-dom'; | |
| import Badge from '../badges'; | |
| import { | |
| BadgesContainer, | |
| Byline, | |
| GutterTimestamp, | |
| Name, | |
| Username, | |
| } from './style'; | |
| type Props = { | |
| user: Object, | |
| timestamp: string, | |
| roles?: Array<string>, | |
| bot?: boolean, | |
| messageUrl: string, | |
| }; | |
| export default (props: Props) => { | |
| const { user, roles, timestamp, messageUrl } = props; | |
| return ( | |
| <Byline> | |
| <ConditionalWrap | |
| condition={!!user.username} | |
| wrap={children => ( | |
| <UserHoverProfile | |
| username={user.username} | |
| style={{ flexWrap: 'wrap', flex: '0 1 auto' }} | |
| > | |
| <Link | |
| to={`/users/${user.username}`} | |
| onClick={e => e.stopPropagation()} | |
| > | |
| {children} | |
| <Username>{user.username && `@${user.username}`}</Username> | |
| </Link> | |
| </UserHoverProfile> | |
| )} | |
| > | |
| <Name>{user.name}</Name> | |
| </ConditionalWrap> | |
| <BadgesContainer> | |
| {roles && | |
| roles.map((role, index) => ( | |
| <Badge type={role} key={index} onClick={e => e.stopPropagation()} /> | |
| ))} | |
| {user.betaSupporter && ( | |
| <Badge | |
| type="beta-supporter" | |
| label={'β'} | |
| style={{ textTransform: 'none' }} | |
| /> | |
| )} | |
| </BadgesContainer> | |
| <GutterTimestamp to={messageUrl} data-cy="message-timestamp"> | |
| {convertTimestampToTime(new Date(timestamp))} | |
| </GutterTimestamp> | |
| </Byline> | |
| ); | |
| }; | |