Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

[MM-35922] Fixed a couple style issues with the sidebar category headers on drag #8157

Merged
merged 4 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 78 additions & 79 deletions components/sidebar/sidebar_category_header.tsx
Original file line number Diff line number Diff line change
@@ -1,79 +1,78 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

import classNames from 'classnames';
import React from 'react';
import {DraggableProvidedDragHandleProps} from 'react-beautiful-dnd';

import {wrapEmojis} from 'utils/emoji_utils';

type StaticProps = {
children?: React.ReactNode;
displayName: string;
}

export const SidebarCategoryHeaderStatic = React.forwardRef((props: StaticProps, ref?: React.Ref<HTMLDivElement>) => {
return (
<div className='SidebarChannelGroupHeader SidebarChannelGroupHeader--static'>
<div
ref={ref}
className='SidebarChannelGroupHeader_groupButton'
>
<div className='SidebarChannelGroupHeader_text'>
{wrapEmojis(props.displayName)}
</div>
{props.children}
</div>
</div>
);
});
SidebarCategoryHeaderStatic.displayName = 'SidebarCategoryHeaderStatic';

type Props = StaticProps & {
dragHandleProps?: DraggableProvidedDragHandleProps;
isCollapsed: boolean;
isCollapsible: boolean;
isDragging?: boolean;
isDraggingOver?: boolean;
muted: boolean;
onClick: (event: React.MouseEvent<HTMLElement>) => void;
}

export const SidebarCategoryHeader = React.forwardRef((props: Props, ref?: React.Ref<HTMLButtonElement>) => {
return (
<div
className={classNames('SidebarChannelGroupHeader', {
muted: props.muted,
})}
>
<button
ref={ref}
className={classNames('SidebarChannelGroupHeader_groupButton', {
dragging: props.isDragging,
})}
aria-label={props.displayName}
onClick={props.onClick}
>
<i
className={classNames('icon icon-chevron-down', {
'icon-rotate-minus-90': props.isCollapsed,
'hide-arrow': !props.isCollapsible,
})}
/>
<div
className='SidebarChannelGroupHeader_text'
{...props.dragHandleProps}
>
{wrapEmojis(props.displayName)}
</div>
</button>
{props.children}
</div>
);
});
SidebarCategoryHeader.defaultProps = {
isCollapsible: true,
isDragging: false,
isDraggingOver: false,
};
SidebarCategoryHeader.displayName = 'SidebarCategoryHeader';
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

import classNames from 'classnames';
import React from 'react';
import {DraggableProvidedDragHandleProps} from 'react-beautiful-dnd';

import {wrapEmojis} from 'utils/emoji_utils';

type StaticProps = {
children?: React.ReactNode;
displayName: string;
}

export const SidebarCategoryHeaderStatic = React.forwardRef((props: StaticProps, ref?: React.Ref<HTMLDivElement>) => {
return (
<div className='SidebarChannelGroupHeader SidebarChannelGroupHeader--static'>
<div
ref={ref}
className='SidebarChannelGroupHeader_groupButton'
>
<div className='SidebarChannelGroupHeader_text'>
{wrapEmojis(props.displayName)}
</div>
{props.children}
</div>
</div>
);
});
SidebarCategoryHeaderStatic.displayName = 'SidebarCategoryHeaderStatic';

type Props = StaticProps & {
dragHandleProps?: DraggableProvidedDragHandleProps;
isCollapsed: boolean;
isCollapsible: boolean;
isDragging?: boolean;
isDraggingOver?: boolean;
muted: boolean;
onClick: (event: React.MouseEvent<HTMLElement>) => void;
}

export const SidebarCategoryHeader = React.forwardRef((props: Props, ref?: React.Ref<HTMLButtonElement>) => {
return (
<div
className={classNames('SidebarChannelGroupHeader', {
muted: props.muted,
dragging: props.isDragging,
})}
>
<button
ref={ref}
className={classNames('SidebarChannelGroupHeader_groupButton')}
aria-label={props.displayName}
onClick={props.onClick}
>
<i
className={classNames('icon icon-chevron-down', {
'icon-rotate-minus-90': props.isCollapsed,
'hide-arrow': !props.isCollapsible,
})}
/>
<div
className='SidebarChannelGroupHeader_text'
{...props.dragHandleProps}
>
{wrapEmojis(props.displayName)}
</div>
</button>
{props.children}
</div>
);
});
SidebarCategoryHeader.defaultProps = {
isCollapsible: true,
isDragging: false,
isDraggingOver: false,
};
SidebarCategoryHeader.displayName = 'SidebarCategoryHeader';
Loading