Skip to content

Commit

Permalink
Allow header collapse button to be hidden (#893)
Browse files Browse the repository at this point in the history
  • Loading branch information
thecalcc authored Nov 13, 2024
1 parent 6f59d43 commit ee339ef
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
13 changes: 9 additions & 4 deletions app-typescript/components/Layouts/AuthoringInnerHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ interface IProps {
children?: React.ReactNode;
collapsed?: boolean;
headerPadding?: HeaderPadding;
hideCollapseButton?: boolean;
}

interface IState {
Expand All @@ -23,6 +24,8 @@ export class AuthoringInnerHeader extends React.PureComponent<IProps, IState> {
}

render() {
const hideCollapseButton = this.props.hideCollapseButton ?? false;

const classes = classNames('sd-editor-content__authoring-header', {
'authoring-header--collapsed': this.state.collapsed,
});
Expand All @@ -41,10 +44,12 @@ export class AuthoringInnerHeader extends React.PureComponent<IProps, IState> {
<div className="authoring-header__holder">
{this.props.children}
</div>
<button className="authoring-header__toggle"
onClick={() => this.setState({collapsed: !this.state.collapsed})}>
<Icon name="chevron-up-thin" />
</button>
{!hideCollapseButton && (
<button className="authoring-header__toggle"
onClick={() => this.setState({collapsed: !this.state.collapsed})}>
<Icon name="chevron-up-thin" />
</button>
)}
</header>
);
}
Expand Down
2 changes: 2 additions & 0 deletions app-typescript/components/Layouts/AuthoringMain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ interface IProps {
authoringHeader?: React.ReactNode;
authoringBookmarks?: React.ReactNode;
headerCollapsed?: boolean;
hideCollapseButton?: boolean;
headerPadding?: HeaderPadding;
toolbarCustom?: boolean;
noPaddingForContent?: boolean;
Expand All @@ -39,6 +40,7 @@ export class AuthoringMain extends React.PureComponent<IProps> {
<AuthoringMainContent>
{this.props.authoringHeader && (
<AuthoringInnerHeader
hideCollapseButton={this.props.hideCollapseButton}
headerPadding={this.props.headerPadding}
collapsed={this.props.headerCollapsed}>
{this.props.authoringHeader}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "superdesk-ui-framework",
"version": "4.0.0",
"version": "4.0.1",
"license": "AGPL-3.0",
"repository": {
"type": "git",
Expand Down

0 comments on commit ee339ef

Please sign in to comment.