GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — algorithm-visualizer/src/components/Button/index.js at master · byplus/algorithm-visualizer

Expand file tree

/

index.js

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
89 lines (79 loc) · 2.69 KB
/

index.js

Copy path

File metadata and controls

89 lines (79 loc) · 2.69 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import React from 'react';
import { Link } from 'react-router-dom';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import faExclamationCircle from '@fortawesome/fontawesome-free-solid/faExclamationCircle';
import faSpinner from '@fortawesome/fontawesome-free-solid/faSpinner';
import { classes } from 'common/util';
import { Ellipsis } from 'components';
import styles from './Button.module.scss';
class Button extends React.Component {
constructor(props) {
super(props);
this.state = {
confirming: false,
};
this.timeout = null;
}
componentWillUnmount() {
if (this.timeout) {
window.clearTimeout(this.timeout);
this.timeout = undefined;
}
}
render() {
let { className, children, to, href, onClick, icon, reverse, selected, disabled, primary, active, confirmNeeded, inProgress, ...rest } = this.props;
const { confirming } = this.state;
if (confirmNeeded) {
if (confirming) {
className = classes(styles.confirming, className);
icon = faExclamationCircle;
children = <Ellipsis key="text">Click to Confirm</Ellipsis>;
const onClickOriginal = onClick;
onClick = () => {
if (onClickOriginal) onClickOriginal();
if (this.timeout) {
window.clearTimeout(this.timeout);
this.timeout = undefined;
this.setState({ confirming: false });
}
};
} else {
to = null;
href = null;
onClick = () => {
this.setState({ confirming: true });
this.timeout = window.setTimeout(() => {
this.timeout = undefined;
this.setState({ confirming: false });
}, 2000);
};
}
}
const iconOnly = !children;
const props = {
className: classes(styles.button, reverse && styles.reverse, selected && styles.selected, disabled && styles.disabled, primary && styles.primary, active && styles.active, iconOnly && styles.icon_only, className),
to: disabled ? null : to,
href: disabled ? null : href,
onClick: disabled ? null : onClick,
children: [
icon && (
typeof icon === 'string' ?
<div className={classes(styles.icon, styles.image)} key="icon"
style={{ backgroundImage: `url(${icon})` }} /> :
<FontAwesomeIcon className={styles.icon} fixedWidth icon={inProgress ? faSpinner : icon} spin={inProgress}
key="icon" />
),
children,
],
...rest,
};
return to ? (
<Link {...props} />
) : href ? (
<a rel="noopener" target="_blank" {...props} />
) : (
<div {...props} />
);
}
}
export default Button;
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.