-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathUserList.tsx
More file actions
65 lines (59 loc) · 1.79 KB
/
Copy pathUserList.tsx
File metadata and controls
65 lines (59 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import React from 'react';
import User from './User'
import styled from 'styled-components'
import { List, Skeleton, Button } from 'antd';
import OrganizationsAPI from "../../lib/api/organizations";
const StyledHeader = styled.div`
font-family: Open Sans, sans-serif;
font-style: normal;
font-weight: 600;
font-size: 1.25em;
line-height: 1.7em;
color: rgba(0, 0, 0, 0.5);
margin-bottom: 0.2em;
`
const UserList = (props) => {
const handleClick = (org,user) => {
OrganizationsAPI.removeFromOrg(org,user);
}
return (
<>
<StyledHeader>{props.header}</StyledHeader>
<List
className="user-list"
itemLayout="horizontal"
dataSource={props.users}
renderItem={ user => (
<List.Item style={{border: 'none'}}>
<Skeleton avatar title={false} loading={props.loading} active>
<User
currentOrg = {props.currentOrg ? props.currentOrg : null}
name = {user['profile']['username']}
image = {user['profile']['image']}
username = {user['profile']['username']}
following = {user['profile']['following']}
hasButton = {true}
/>
{props.currentOrg ? <Button
type={'primary'}
size={'middle'}
onClick={() => handleClick(props.currentOrg,user['profile']['username'])}
style={{
fontSize: '1em',
fontWeight: 'bold',
background: '#DD2E44',
borderColor: '#DD2E44',
borderRadius: '0.5em',
padding: '0em 1em',
}}>
Delete
</Button> : null
}
</Skeleton>
</List.Item>
)}
/>
</>
)
}
export default UserList