Skip to content

Commit

Permalink
adding back dts, converting a few components to fns
Browse files Browse the repository at this point in the history
  • Loading branch information
tnrich committed Jun 5, 2024
1 parent f088e61 commit fb106ec
Show file tree
Hide file tree
Showing 9 changed files with 477 additions and 526 deletions.
539 changes: 266 additions & 273 deletions output.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/ove/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@teselagen/ove",
"version": "0.5.11",
"version": "0.5.13",
"main": "./src/index.js",
"type": "module",
"exports": {
Expand Down
18 changes: 7 additions & 11 deletions packages/ove/src/AlignmentTool/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@ import React from "react";
// import CutsiteFilter from "../CutsiteFilter";
// import { Tabs, Tab, Button, InputGroup, Intent } from "@blueprintjs/core";

export default class AlignmentTool extends React.Component {
// state={selectedTab: "virtualDigest"}
render() {
const { height = "100%" } = this.props;
return (
<div style={{ height, overflow: "auto", padding: 10 }}>
<div>Add an alignment file (.gb, .fasta, .ab)</div>
</div>
);
}
}
export default ({ height = "100%" }) => {
return (
<div style={{ height, overflow: "auto", padding: 10 }}>
<div>Add an alignment file (.gb, .fasta, .ab)</div>
</div>
);
};
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@teselagen/ui",
"version": "0.4.8",
"version": "0.4.10",
"main": "./src/index.js",
"type": "module",
"exports": {
Expand Down
136 changes: 56 additions & 80 deletions packages/ui/src/CollapsibleCard/index.js
Original file line number Diff line number Diff line change
@@ -1,92 +1,68 @@
import React, { Component } from "react";
import React, { useState } from "react";
import { Button, Classes, Icon } from "@blueprintjs/core";
import classNames from "classnames";
import "./style.css";

export default class CollapsibleCard extends Component {
state = {
open: true
};

constructor(props) {
super(props);
this.state = {
open: !props.initialClosed
};
}
export default function CollapsibleCard({
title,
icon,
openTitleElements,
noCard = false,
className,
style,
children,
initialClosed = false,
toggle,
isOpen
}) {
let [open, setOpen] = useState(!initialClosed);
if (isOpen !== undefined) open = isOpen;

renderOpenCard() {
return this.props.children;
}

toggleCardInfo = () => {
if (this.props.toggle) this.props.toggle();
const toggleCardInfo = () => {
if (toggle) toggle();
else {
this.setState({
open: !this.state.open
});
}
};

getIsOpen = () => {
if (this.props.isOpen !== undefined) {
return this.props.isOpen;
} else {
return this.state.open;
setOpen(!open);
}
};

render() {
const open = this.getIsOpen();
const {
title,
icon,
openTitleElements,
noCard = false,
className,
style
} = this.props;

// blueprintjs card will match our table color. which looks really bad when a table is in a card.
return (
<div
className={classNames({ "tg-card": !noCard, open }, className)}
style={{
paddingTop: 10,
paddingBottom: 10,
paddingLeft: 15,
paddingRight: 15,
...style
}}
>
<div className="tg-card-header" style={{ marginBottom: 8 }}>
<div className="tg-card-header-title">
{icon && <Icon icon={icon} />}
<h6
style={{
marginBottom: 0,
marginRight: 10,
marginLeft: 10
}}
>
{title}
</h6>
<div>{open && openTitleElements}</div>
</div>
<div>
<Button
icon={open ? "minimize" : "maximize"}
className={classNames(
Classes.MINIMAL,
"info-btn",
"tg-collapse-toggle"
)}
onClick={this.toggleCardInfo}
/>
</div>
return (
<div
className={classNames({ "tg-card": !noCard, open }, className)}
style={{
paddingTop: 10,
paddingBottom: 10,
paddingLeft: 15,
paddingRight: 15,
...style
}}
>
<div className="tg-card-header" style={{ marginBottom: 8 }}>
<div className="tg-card-header-title">
{icon && <Icon icon={icon} />}
<h6
style={{
marginBottom: 0,
marginRight: 10,
marginLeft: 10
}}
>
{title}
</h6>
<div>{open && openTitleElements}</div>
</div>
<div>
<Button
icon={open ? "minimize" : "maximize"}
className={classNames(
Classes.MINIMAL,
"info-btn",
"tg-collapse-toggle"
)}
onClick={toggleCardInfo}
/>
</div>
{open && this.renderOpenCard()}
</div>
);
}
{open && children}
</div>
);
}
145 changes: 70 additions & 75 deletions packages/ui/src/InfoHelper/index.js
Original file line number Diff line number Diff line change
@@ -1,83 +1,78 @@
import React, { Component } from "react";
import React from "react";
import { Popover, Button, Tooltip, Icon } from "@blueprintjs/core";
import classnames from "classnames";
import "./style.css";
import { popoverOverflowModifiers } from "..";

export default class InfoHelper extends Component {
render() {
const {
className,
content,
children,
icon = "info-sign",
isPopover,
isButton,
size,
isInline,
clickable,
color,
noMarginTop,
popoverProps = {},
disabled,
displayToSide,
style,
...rest
} = this.props;
const IconToUse = isButton ? Button : Icon;
const iconProps = {
icon,
color,
disabled
};
if (!isButton) iconProps.iconSize = size;
export default ({
className,
content,
children,
icon = "info-sign",
isPopover,
isButton,
size,
isInline,
clickable,
color,
noMarginTop,
popoverProps = {},
disabled,
displayToSide,
style,
...rest
}) => {
const IconToUse = isButton ? Button : Icon;
const iconProps = {
icon,
color,
disabled
};
if (!isButton) iconProps.iconSize = size;

const IconInner = <IconToUse {...iconProps} {...rest} />;
let toReturn;
const toolTipOrPopoverProps = {
disabled:
disabled ||
(!isPopover &&
window.Cypress &&
!window.Cypress.allowInfoHelperTooltips),
popoverClassName: "tg-info-helper-popover bp3-tooltip",
content: content || children,
modifiers: popoverOverflowModifiers,
...popoverProps
};
if (displayToSide) {
toReturn = (
<React.Fragment>
{IconInner}
<span style={{ paddingLeft: 5, fontStyle: "italic" }}>
{content || children}
</span>
</React.Fragment>
);
} else if (isPopover) {
toReturn = <Popover {...toolTipOrPopoverProps} target={IconInner} />;
} else {
toReturn = <Tooltip {...toolTipOrPopoverProps} target={IconInner} />;
}
const El = isInline ? "span" : "div";
return (
<El
style={{
...(clickable ? { cursor: "pointer" } : {}),
...(isInline ? {} : { display: "flex" }),
...style
}}
className={classnames(
"info-helper-wrapper",
{
"info-helper-wrapper-noMarginTop": noMarginTop,
"info-helper-clickable": isPopover
},
className
)}
>
{toReturn}
</El>
const IconInner = <IconToUse {...iconProps} {...rest} />;
let toReturn;
const toolTipOrPopoverProps = {
disabled:
disabled ||
(!isPopover && window.Cypress && !window.Cypress.allowInfoHelperTooltips),
popoverClassName: "tg-info-helper-popover bp3-tooltip",
content: content || children,
modifiers: popoverOverflowModifiers,
...popoverProps
};
if (displayToSide) {
toReturn = (
<React.Fragment>
{IconInner}
<span style={{ paddingLeft: 5, fontStyle: "italic" }}>
{content || children}
</span>
</React.Fragment>
);
} else if (isPopover) {
toReturn = <Popover {...toolTipOrPopoverProps} target={IconInner} />;
} else {
toReturn = <Tooltip {...toolTipOrPopoverProps} target={IconInner} />;
}
}
const El = isInline ? "span" : "div";
return (
<El
style={{
...(clickable ? { cursor: "pointer" } : {}),
...(isInline ? {} : { display: "flex" }),
...style
}}
className={classnames(
"info-helper-wrapper",
{
"info-helper-wrapper-noMarginTop": noMarginTop,
"info-helper-clickable": isPopover
},
className
)}
>
{toReturn}
</El>
);
};

0 comments on commit fb106ec

Please sign in to comment.