Skip to content

Commit

Permalink
CloseButton_component_changes_revert
Browse files Browse the repository at this point in the history
  • Loading branch information
Lungsangg authored Jan 31, 2025
1 parent 1950be1 commit 2a5733e
Showing 1 changed file with 10 additions and 27 deletions.
37 changes: 10 additions & 27 deletions static/js/Misc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1348,38 +1348,21 @@ MenuButton.propTypes = {


class CloseButton extends Component {
onClick = (e) => {
e.preventDefault(); // Prevent the default anchor behavior
e.stopPropagation(); // Stop event bubbling

// Use a small timeout to ensure onClick completes
setTimeout(() => {
window.history.go(-1);
}, 0);
onClick(e) {
e.preventDefault();
this.props.onClick();
}

render() {
let icon;
if (this.props.icon == "circledX") {
icon = <img src="/static/icons/circled-x.svg" alt="Close" />;
if (this.props.icon == "circledX"){
var icon = <img src="/static/icons/circled-x.svg" />;
} else if (this.props.icon == "chevron") {
icon = <i className="fa fa-chevron-left"></i>;
var icon = <i className="fa fa-chevron-left"></i>
} else {
icon = <i className="fa fa-arrow-left back-button-icon"></i>;
var icon = "×";
}

const classes = classNames({
readerNavMenuCloseButton: 1,
circledX: this.props.icon === "circledX"
});

const url = this.props.url || "#"; // Use # as fallback to prevent page reload

return (
<a href={url} className={classes} onClick={this.onClick}>
{icon}
</a>
);
var classes = classNames({readerNavMenuCloseButton: 1, circledX: this.props.icon === "circledX"});
var url = this.props.url || "";
return (<a href={url} className={classes} onClick={this.onClick}>{icon}</a>);
}
}

Expand Down

0 comments on commit 2a5733e

Please sign in to comment.