Skip to content

Commit fff8fc2

Browse files
committed
removing some use of react-bootstrap
1 parent a46605d commit fff8fc2

File tree

4 files changed

+9
-27
lines changed

4 files changed

+9
-27
lines changed

src/packages/frontend/antd-bootstrap.tsx

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function parse_bsStyle(props: {
9191
let type =
9292
props.bsStyle == null
9393
? "default"
94-
: BS_STYLE_TO_TYPE[props.bsStyle] ?? "default";
94+
: (BS_STYLE_TO_TYPE[props.bsStyle] ?? "default");
9595

9696
let style: React.CSSProperties | undefined = undefined;
9797
// antd has no analogue of "success" & "warning", it's not clear to me what
@@ -267,14 +267,7 @@ export function Well(props: {
267267
);
268268
}
269269

270-
export function Checkbox(props: {
271-
style?: React.CSSProperties;
272-
children?: any;
273-
autoFocus?: boolean;
274-
checked?: boolean;
275-
disabled?: boolean;
276-
onChange?: any;
277-
}) {
270+
export function Checkbox(props) {
278271
const style: React.CSSProperties = props.style != null ? props.style : {};
279272
if (style.fontWeight == null) {
280273
// Antd checkbox uses the label DOM element, and bootstrap css
@@ -288,15 +281,7 @@ export function Checkbox(props: {
288281
// has that margin.
289282
return (
290283
<div style={{ margin: "10px 0" }}>
291-
<AntdCheckbox
292-
autoFocus={props.autoFocus}
293-
checked={props.checked}
294-
disabled={props.disabled}
295-
style={style}
296-
onChange={props.onChange}
297-
>
298-
{props.children}
299-
</AntdCheckbox>
284+
<AntdCheckbox {...{ ...props, style }}>{props.children}</AntdCheckbox>
300285
</div>
301286
);
302287
}

src/packages/frontend/project/explorer/action-box.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
FormGroup,
2828
Alert,
2929
Checkbox,
30-
} from "react-bootstrap";
30+
} from "@cocalc/frontend/antd-bootstrap";
3131
import * as account from "@cocalc/frontend/account";
3232
import SelectServer from "@cocalc/frontend/compute/select-server";
3333
import ConfigureShare from "@cocalc/frontend/share/config";
@@ -554,15 +554,13 @@ export const ActionBox = rclass<ReactProps>(
554554
return (
555555
<div>
556556
<Checkbox
557-
ref="delete_extra_files_checkbox"
558557
onChange={(e) =>
559558
this.setState({ delete_extra_files: (e.target as any).checked })
560559
}
561560
>
562561
Delete extra files in target directory
563562
</Checkbox>
564563
<Checkbox
565-
ref="overwrite_newer_checkbox"
566564
onChange={(e) =>
567565
this.setState({ overwrite_newer: (e.target as any).checked })
568566
}

src/packages/frontend/project/explorer/explorer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { Alert } from "antd";
77
import * as immutable from "immutable";
88
import React from "react";
9-
import { Button, ButtonGroup, Col, Row } from "react-bootstrap";
9+
import { Button, ButtonGroup, Col, Row } from "@cocalc/frontend/antd-bootstrap";
1010
import * as underscore from "underscore";
1111
import { UsersViewing } from "@cocalc/frontend/account/avatar/users-viewing";
1212
import {

src/packages/frontend/project/history/log-entry.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
*/
55
import { Space, Tooltip } from "antd";
66
import React from "react";
7-
import { Col, Grid, Row } from "react-bootstrap";
8-
7+
import { Col, Grid, Row } from "@cocalc/frontend/antd-bootstrap";
98
import { Avatar } from "@cocalc/frontend/account/avatar/avatar";
109
import {
1110
CSS,
@@ -205,10 +204,10 @@ export const LogEntry: React.FC<Props> = React.memo(
205204
): JSX.Element {
206205
const envs = software_envs?.get("environments");
207206
const prev: string = envs
208-
? envs.get(event.previous)?.get("title") ?? event.previous
207+
? (envs.get(event.previous)?.get("title") ?? event.previous)
209208
: intl.formatMessage(labels.loading);
210209
const next: string = envs
211-
? envs.get(event.next)?.get("title") ?? event.next
210+
? (envs.get(event.next)?.get("title") ?? event.next)
212211
: intl.formatMessage(labels.loading);
213212

214213
return (
@@ -906,7 +905,7 @@ export const LogEntry: React.FC<Props> = React.memo(
906905
case "full":
907906
const style = props.cursor ? selected_item : backgroundStyle;
908907
return (
909-
<Grid fluid={true} style={{ width: "100%" }}>
908+
<Grid style={{ width: "100%" }}>
910909
<Row style={style}>
911910
<Col sm={1} style={{ textAlign: "center" }}>
912911
<Icon name={icon()} style={style} />

0 commit comments

Comments
 (0)