Design tweaks to add-story-button hover
This commit is contained in:
parent
810cbb5fe5
commit
2278bf2994
6 changed files with 26 additions and 12 deletions
|
@ -5353,9 +5353,9 @@ button.module-image__border-overlay:focus {
|
||||||
}
|
}
|
||||||
|
|
||||||
@include dark-theme {
|
@include dark-theme {
|
||||||
background: $color-gray-80;
|
background: $color-gray-75;
|
||||||
::-webkit-scrollbar-thumb {
|
::-webkit-scrollbar-thumb {
|
||||||
border: 2px solid $color-gray-80;
|
border: 2px solid $color-gray-75;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
// highlighted on hover and when it has triggered a context menu
|
||||||
|
// that has not been closed yet (active)
|
||||||
|
&:hover,
|
||||||
|
&--active {
|
||||||
background: $color-gray-65;
|
background: $color-gray-65;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,9 @@ import React from 'react';
|
||||||
import { expect } from '@storybook/jest';
|
import { expect } from '@storybook/jest';
|
||||||
import { within, userEvent } from '@storybook/testing-library';
|
import { within, userEvent } from '@storybook/testing-library';
|
||||||
|
|
||||||
import type { PropsType } from './MyStoriesButton';
|
import type { PropsType } from './MyStoryButton';
|
||||||
import enMessages from '../../_locales/en/messages.json';
|
import enMessages from '../../_locales/en/messages.json';
|
||||||
import { MyStoriesButton } from './MyStoriesButton';
|
import { MyStoryButton } from './MyStoryButton';
|
||||||
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
|
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
|
||||||
import { getFakeStoryView } from '../test-both/helpers/getFakeStory';
|
import { getFakeStoryView } from '../test-both/helpers/getFakeStory';
|
||||||
import { setupI18n } from '../util/setupI18n';
|
import { setupI18n } from '../util/setupI18n';
|
||||||
|
@ -19,7 +19,7 @@ const i18n = setupI18n('en', enMessages);
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
title: 'Components/MyStoriesButton',
|
title: 'Components/MyStoriesButton',
|
||||||
component: MyStoriesButton,
|
component: MyStoryButton,
|
||||||
argTypes: {
|
argTypes: {
|
||||||
hasMultiple: {
|
hasMultiple: {
|
||||||
control: 'checkbox',
|
control: 'checkbox',
|
||||||
|
@ -41,7 +41,7 @@ export default {
|
||||||
},
|
},
|
||||||
} as Meta;
|
} as Meta;
|
||||||
|
|
||||||
const Template: Story<PropsType> = args => <MyStoriesButton {...args} />;
|
const Template: Story<PropsType> = args => <MyStoryButton {...args} />;
|
||||||
|
|
||||||
const interactionTest: PlayFunction<ReactFramework, PropsType> = async ({
|
const interactionTest: PlayFunction<ReactFramework, PropsType> = async ({
|
||||||
args,
|
args,
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright 2022 Signal Messenger, LLC
|
// Copyright 2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import React from 'react';
|
import React, { useState } from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import type { ConversationType } from '../state/ducks/conversations';
|
import type { ConversationType } from '../state/ducks/conversations';
|
||||||
import type { LocalizerType } from '../types/Util';
|
import type { LocalizerType } from '../types/Util';
|
||||||
|
@ -53,7 +53,7 @@ function resolveSendStatus(
|
||||||
return ResolvedSendStatus.Sent;
|
return ResolvedSendStatus.Sent;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MyStoriesButton = ({
|
export const MyStoryButton = ({
|
||||||
hasMultiple,
|
hasMultiple,
|
||||||
i18n,
|
i18n,
|
||||||
me,
|
me,
|
||||||
|
@ -63,6 +63,8 @@ export const MyStoriesButton = ({
|
||||||
queueStoryDownload,
|
queueStoryDownload,
|
||||||
showToast,
|
showToast,
|
||||||
}: PropsType): JSX.Element => {
|
}: PropsType): JSX.Element => {
|
||||||
|
const [active, setActive] = useState(false);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
acceptedMessageRequest,
|
acceptedMessageRequest,
|
||||||
avatarPath,
|
avatarPath,
|
||||||
|
@ -116,13 +118,19 @@ export const MyStoriesButton = ({
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="StoryListItem__button">
|
<div
|
||||||
|
className={classNames(
|
||||||
|
'StoryListItem__button',
|
||||||
|
active && 'StoryListItem__button--active'
|
||||||
|
)}
|
||||||
|
>
|
||||||
<div className="MyStories__avatar-container">
|
<div className="MyStories__avatar-container">
|
||||||
<StoriesAddStoryButton
|
<StoriesAddStoryButton
|
||||||
i18n={i18n}
|
i18n={i18n}
|
||||||
moduleClassName="StoryListItem--active-opacity"
|
moduleClassName="StoryListItem--active-opacity"
|
||||||
onAddStory={onAddStory}
|
onAddStory={onAddStory}
|
||||||
showToast={showToast}
|
showToast={showToast}
|
||||||
|
onContextMenuShowingChanged={setActive}
|
||||||
>
|
>
|
||||||
<Avatar
|
<Avatar
|
||||||
acceptedMessageRequest={acceptedMessageRequest}
|
acceptedMessageRequest={acceptedMessageRequest}
|
|
@ -19,6 +19,7 @@ export type PropsType = {
|
||||||
i18n: LocalizerType;
|
i18n: LocalizerType;
|
||||||
moduleClassName?: string;
|
moduleClassName?: string;
|
||||||
onAddStory: (file?: File) => unknown;
|
onAddStory: (file?: File) => unknown;
|
||||||
|
onContextMenuShowingChanged?: (value: boolean) => void;
|
||||||
showToast: ShowToastActionCreatorType;
|
showToast: ShowToastActionCreatorType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,11 +29,13 @@ export const StoriesAddStoryButton = ({
|
||||||
moduleClassName,
|
moduleClassName,
|
||||||
onAddStory,
|
onAddStory,
|
||||||
showToast,
|
showToast,
|
||||||
|
onContextMenuShowingChanged,
|
||||||
}: PropsType): JSX.Element => {
|
}: PropsType): JSX.Element => {
|
||||||
return (
|
return (
|
||||||
<ContextMenu
|
<ContextMenu
|
||||||
ariaLabel={i18n('Stories__add')}
|
ariaLabel={i18n('Stories__add')}
|
||||||
i18n={i18n}
|
i18n={i18n}
|
||||||
|
onMenuShowingChanged={onContextMenuShowingChanged}
|
||||||
menuOptions={[
|
menuOptions={[
|
||||||
{
|
{
|
||||||
label: i18n('Stories__add-story--media'),
|
label: i18n('Stories__add-story--media'),
|
||||||
|
|
|
@ -19,7 +19,7 @@ import type { PreferredBadgeSelectorType } from '../state/selectors/badges';
|
||||||
import type { ShowToastActionCreatorType } from '../state/ducks/toast';
|
import type { ShowToastActionCreatorType } from '../state/ducks/toast';
|
||||||
import type { ViewUserStoriesActionCreatorType } from '../state/ducks/stories';
|
import type { ViewUserStoriesActionCreatorType } from '../state/ducks/stories';
|
||||||
import { ContextMenu } from './ContextMenu';
|
import { ContextMenu } from './ContextMenu';
|
||||||
import { MyStoriesButton } from './MyStoriesButton';
|
import { MyStoryButton } from './MyStoryButton';
|
||||||
import { SearchInput } from './SearchInput';
|
import { SearchInput } from './SearchInput';
|
||||||
import { StoriesAddStoryButton } from './StoriesAddStoryButton';
|
import { StoriesAddStoryButton } from './StoriesAddStoryButton';
|
||||||
import { StoryListItem } from './StoryListItem';
|
import { StoryListItem } from './StoryListItem';
|
||||||
|
@ -160,7 +160,7 @@ export const StoriesPane = ({
|
||||||
/>
|
/>
|
||||||
<div className="Stories__pane__list">
|
<div className="Stories__pane__list">
|
||||||
<>
|
<>
|
||||||
<MyStoriesButton
|
<MyStoryButton
|
||||||
hasMultiple={
|
hasMultiple={
|
||||||
myStories.length ? myStories[0].stories.length > 1 : false
|
myStories.length ? myStories[0].stories.length > 1 : false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue