Download spectrum/src/components/hoverProfile/communityProfile.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 2.46 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/src/components/hoverProfile/communityProfile.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/src/components/hoverProfile/communityProfile.js
-
curl -L -o communityProfile.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/src/components/hoverProfile/communityProfile.js
2.46 kB
| // @flow | |
| import React, { Component } from 'react'; | |
| import compose from 'recompose/compose'; | |
| import { connect } from 'react-redux'; | |
| import { withRouter } from 'react-router'; | |
| import AvatarImage from 'src/components/avatar/image'; | |
| import { Link } from 'react-router-dom'; | |
| import { Button, OutlineButton } from 'src/components/button'; | |
| import type { GetCommunityType } from 'shared/graphql/queries/community/getCommunity'; | |
| import renderTextWithLinks from 'src/helpers/render-text-with-markdown-links'; | |
| import type { Dispatch } from 'redux'; | |
| import { withCurrentUser } from 'src/components/withCurrentUser'; | |
| import { | |
| HoverWrapper, | |
| ProfileCard, | |
| CoverContainer, | |
| CoverPhoto, | |
| ProfilePhotoContainer, | |
| Content, | |
| Title, | |
| Description, | |
| Actions, | |
| } from './style'; | |
| type ProfileProps = { | |
| community: GetCommunityType, | |
| dispatch: Dispatch<Object>, | |
| currentUser: ?Object, | |
| ref: (?HTMLElement) => void, | |
| style: CSSStyleDeclaration, | |
| }; | |
| class HoverProfile extends Component<ProfileProps> { | |
| render() { | |
| const { community, ref, style } = this.props; | |
| const { communityPermissions } = community; | |
| const { isOwner, isModerator } = communityPermissions; | |
| return ( | |
| <HoverWrapper popperStyle={style} ref={ref}> | |
| <ProfileCard> | |
| <Link to={`/${community.slug}`}> | |
| <CoverContainer> | |
| <CoverPhoto src={community.coverPhoto} /> | |
| <ProfilePhotoContainer> | |
| <AvatarImage | |
| src={community.profilePhoto} | |
| type={'community'} | |
| size={40} | |
| isClickable={false} | |
| alt={community.name} | |
| /> | |
| </ProfilePhotoContainer> | |
| </CoverContainer> | |
| </Link> | |
| <Content> | |
| <Link to={`/${community.slug}`}> | |
| <Title>{community.name}</Title> | |
| </Link> | |
| {community.description && ( | |
| <Description> | |
| {renderTextWithLinks(community.description)} | |
| </Description> | |
| )} | |
| </Content> | |
| <Actions> | |
| {(isModerator || isOwner) && ( | |
| <Link to={`/${community.slug}/settings`}> | |
| <OutlineButton icon={'settings'}>Settings</OutlineButton> | |
| </Link> | |
| )} | |
| </Actions> | |
| </ProfileCard> | |
| </HoverWrapper> | |
| ); | |
| } | |
| } | |
| export default compose( | |
| withCurrentUser, | |
| withRouter, | |
| connect() | |
| )(HoverProfile); | |