import React from 'react'; import PropTypes from 'prop-types'; import uid from 'uuid/v4'; import _ from 'lodash'; import { faker } from '@faker-js/faker/locale/fr'; import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd'; import classNames from 'classnames'; import { Table, Badge, Avatar, AvatarAddOn, Progress, Card, CardHeader, CardTitle } from './../../../../components'; import { randomAvatar, randomArray } from './../../../../utilities'; import { reorder } from './utilities'; import classes from './common.scss'; const allSkills = ['JavaScript', 'Photoshop', 'Management', 'Bootstrap', 'PHP', 'Sketch', 'MySQL', 'Mongo', 'Node.js', 'TypeScript']; const generateUser = () => ({ id: uid(), name: `${faker.name.firstName()} ${faker.name.lastName()}`, title: faker.name.jobType(), avatarUrl: randomAvatar(), status: randomArray(['success', 'warning', 'danger']), skills: _.uniq(_.times(_.random(2, 5), () => randomArray(allSkills))), interviewProgress: _.random(40, 90), portfolio: (Math.round(Math.random())) ? { url: 'http://webkom.co', title: 'www.webkom.co' } : null }); const getTableClass = (isDraggedOver) => classNames(classes['table'], { [classes['table--drag-over']]: isDraggedOver }); const getRowClass = (isDragging) => classNames(classes['row'], { [classes['row--dragging']]: isDragging }); // Custom Table Cell - keeps cell width when the row // is detached from the table // ======================================================== class TableCell extends React.Component { static propTypes = { children: PropTypes.node, isDragOccurring: PropTypes.bool }; ref = React.createRef(); getSnapshotBeforeUpdate(prevProps) { if (!this.ref) { return null; } const ref = this.ref.current; const isDragStarting = this.props.isDragOccurring && !prevProps.isDragOccurring; if (!isDragStarting) { return null; } const { width, height } = ref.getBoundingClientRect(); const snapshot = { width, height }; return snapshot; } componentDidUpdate(prevProps, prevState, snapshot) { if (!this.ref) { return; } const ref = this.ref.current; if (snapshot) { if (ref.style.width === snapshot.width) { return; } ref.style.width = `${snapshot.width}px`; ref.style.height = `${snapshot.height}px`; return; } if (this.props.isDragOccurring) { return; } // inline styles not applied if (ref.style.width == null) { return; } // no snapshot and drag is finished - clear the inline styles ref.style.removeProperty('height'); ref.style.removeProperty('width'); } render() { // eslint-disable-next-line no-unused-vars const { children, isDragOccurring, ...otherProps } = this.props; return
{ props.title }
Photo | Name | Skills | Interview Passed in | Portfolio |
---|