Skip to content

Commit 899e2c2

Browse files
committed
Extract Team
1 parent 282e176 commit 899e2c2

File tree

3 files changed

+47
-13
lines changed

3 files changed

+47
-13
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import TeamIconBase from 'react-icons/lib/md/people';
2+
import styled from 'styled-components';
3+
4+
import { Item as ItemBase } from '../elements';
5+
6+
export const Item = styled(ItemBase)`
7+
color: white;
8+
display: flex;
9+
`;
10+
11+
export const TeamIcon = styled(TeamIconBase)`
12+
font-size: 1.125em;
13+
margin-right: 0.5rem;
14+
`;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import Tooltip from '@codesandbox/common/lib/components/Tooltip';
2+
import React, { FunctionComponent } from 'react';
3+
4+
import { useOvermind } from 'app/overmind';
5+
6+
import { Item, TeamIcon } from './elements';
7+
8+
export const Team: FunctionComponent = () => {
9+
const {
10+
state: {
11+
editor: {
12+
currentSandbox: {
13+
team: { name },
14+
},
15+
},
16+
},
17+
} = useOvermind();
18+
19+
return (
20+
<Tooltip appendTo="parent" content="This sandbox is owned by this team">
21+
<Item>
22+
<TeamIcon />
23+
24+
<div>{name}</div>
25+
</Item>
26+
</Tooltip>
27+
);
28+
};

packages/app/src/app/pages/Sandbox/Editor/Workspace/Project/index.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ import {
77
patronUrl,
88
sandboxUrl,
99
} from '@codesandbox/common/lib/utils/url-generator';
10-
import { PrivacyStatus } from 'app/components/PrivacyStatus';
11-
import { Stats } from 'app/pages/common/Stats';
1210
import React, { ChangeEvent, FunctionComponent } from 'react';
13-
import TeamIcon from 'react-icons/lib/md/people';
1411

12+
import { PrivacyStatus } from 'app/components/PrivacyStatus';
1513
import { useOvermind } from 'app/overmind';
14+
import { Stats } from 'app/pages/common/Stats';
1615

1716
// import { Alias } from './Alias';
1817
import { Author } from './Author';
@@ -35,12 +34,13 @@ import {
3534
import { Frozen } from './Frozen';
3635
import { Keywords } from './Keywords';
3736
import { SandboxConfig } from './SandboxConfig';
37+
import { Team } from './Team';
3838
import { Title } from './Title';
3939

4040
type Props = {
4141
editable?: boolean;
4242
};
43-
export const Project: FunctionComponent<Props> = ({ editable }) => {
43+
export const Project: FunctionComponent<Props> = ({ editable = false }) => {
4444
const {
4545
actions: {
4646
workspace: { sandboxPrivacyChanged },
@@ -76,15 +76,7 @@ export const Project: FunctionComponent<Props> = ({ editable }) => {
7676

7777
{!team && author && <Author />}
7878

79-
{team && (
80-
<Tooltip appendTo="parent" content="This sandbox is owned by this team">
81-
<Item style={{ color: 'white', display: 'flex' }}>
82-
<TeamIcon style={{ fontSize: '1.125em', marginRight: '.5rem' }} />
83-
84-
<div>{team.name}</div>
85-
</Item>
86-
</Tooltip>
87-
)}
79+
{team && <Team/>}
8880

8981
{git && (
9082
<Item>

0 commit comments

Comments
 (0)