@git-temporal/git-temporal-react
Version:
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
49 lines (48 loc) • 2.88 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importDefault(require("react"));
const styles_1 = require("app/styles");
const AuthorGravatarImage_1 = require("app/components/AuthorGravatarImage");
const AddedDeleted_1 = require("app/components/AddedDeleted");
const EpochSpan_1 = require("app/components/EpochSpan");
const Selectable_1 = require("app/components/Selectable");
const menuItemStyle = {
display: 'flex',
padding: 10,
width: '100%',
};
const identifiersStyle = {
_extends: 'flexColumn',
width: '100%',
marginLeft: 10,
};
const authorNameStyle = {
marginBottom: 5,
};
const addedDeletedStyle = {
float: 'none',
};
exports.AuthorCard = (props) => {
const { author, maxImpact, maxCommits, index, isHighlighted } = props;
const addStyles = isHighlighted ? 'selected' : {};
return (react_1.default.createElement("div", { style: styles_1.style('flexRow', props.style) },
react_1.default.createElement(Selectable_1.Selectable, { style: styles_1.style(menuItemStyle, addStyles), onClick: evt => props.onClick(evt, author, index) },
react_1.default.createElement(AuthorGravatarImage_1.AuthorGravatarImage, { emails: author.authorEmails }),
react_1.default.createElement("div", { style: styles_1.style(identifiersStyle) },
react_1.default.createElement("div", { title: author.authorEmails.join(', '), style: styles_1.style(authorNameStyle) }, author.authorName),
react_1.default.createElement("div", { style: styles_1.style('smallerText') },
react_1.default.createElement("div", null,
author.commits.length,
react_1.default.createElement("span", null, " commits spanning "),
react_1.default.createElement(EpochSpan_1.EpochSpan, { firstEpochTime: author.firstCommitOn, secondEpochTime: author.lastCommitOn }))),
react_1.default.createElement("div", { style: styles_1.style('smallerText') },
react_1.default.createElement("span", null, "Last commit "),
react_1.default.createElement(EpochSpan_1.EpochSpan, { firstEpochTime: author.lastCommitOn, secondEpochTime: Date.now() / 1000 }),
react_1.default.createElement("span", null, " ago")),
react_1.default.createElement("div", { style: styles_1.style('smallerText') },
react_1.default.createElement(AddedDeleted_1.AddedDeleted, { linesAdded: author.linesAdded, linesDeleted: author.linesDeleted, style: styles_1.style(addedDeletedStyle) }),
react_1.default.createElement("span", null, " lines changed "))))));
};