Skip to content

Commit 4168e44

Browse files
committed
Fix storybook Notifications and Tooltips
1 parent 4ff15e3 commit 4168e44

File tree

4 files changed

+30
-38
lines changed

4 files changed

+30
-38
lines changed

src/react-components/room/Notification.stories.js

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React from "react";
33
import { RoomLayout } from "../layout/RoomLayout";
44
import styles from "../../assets/stylesheets/presence-log.scss";
55
import PermissionMessage from "../permission-message";
6-
import { NotificationsContainer } from "./NotificationsContainer";
76

87
export default {
98
title: "Room/Notifications",
@@ -54,24 +53,19 @@ const entries = [
5453
export const Base = () => (
5554
<RoomLayout
5655
viewport={
57-
<NotificationsContainer>
58-
<div
59-
style={{ alignItems: "center" }}
60-
className={classNames(styles.presenceLog, styles["presenceLogPermission"])}
61-
>
62-
{entries.map(entry => {
63-
return (
64-
<PermissionMessage
65-
key={entry.key}
66-
permission={entry.permission}
67-
className={classNames(entryClasses, styles.permission)}
68-
body={entry.body}
69-
isMod={false}
70-
/>
71-
);
72-
})}
73-
</div>
74-
</NotificationsContainer>
56+
<div style={{ alignItems: "center" }} className={classNames(styles.presenceLog, styles["presenceLogPermission"])}>
57+
{entries.map(entry => {
58+
return (
59+
<PermissionMessage
60+
key={entry.key}
61+
permission={entry.permission}
62+
className={classNames(entryClasses, styles.permission)}
63+
body={entry.body}
64+
isMod={false}
65+
/>
66+
);
67+
})}
68+
</div>
7569
}
7670
/>
7771
);

src/react-components/room/NotificationsContainer.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import PropTypes from "prop-types";
33
import classNames from "classnames";
44
import styles from "./NotificationsContainer.scss";
55

6-
const isMobile = AFRAME.utils.device.isMobile();
7-
8-
export function NotificationsContainer({ className, children, ...rest }) {
6+
export function NotificationsContainer({ className, children, isMobile, ...rest }) {
97
return (
108
<div className={classNames(className, styles.content, isMobile && styles.mobile)} {...rest}>
119
{children}
@@ -15,5 +13,6 @@ export function NotificationsContainer({ className, children, ...rest }) {
1513

1614
NotificationsContainer.propTypes = {
1715
className: PropTypes.string,
18-
children: PropTypes.node
16+
children: PropTypes.node,
17+
isMobile: PropTypes.bool
1918
};

src/react-components/room/Tip.stories.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,32 @@ Tips.propTypes = {
2626
};
2727

2828
const TOOLTIP_STEPS = {
29-
"tips.desktop.welcome": "Desktop Welcome Message",
30-
"tips.desktop.locomotion": "Desktop Locomotion",
31-
"tips.desktop.turning": "Desktop Turning",
32-
"tips.desktop.invite": "Desktop Invite",
33-
"tips.desktop.end": "Desktop End",
34-
"tips.desktop.menu": "Desktop Menu",
35-
"tips.mobile.welcome": "Mobile Welcome Message",
36-
"tips.mobile.locomotion": "Mobile Locomotion",
37-
"tips.mobile.turning": "Mobile Turning",
38-
"tips.mobile.end": "Mobile End",
39-
"tips.mobile.menu": "Mobile Menu"
29+
"tips.desktop.welcome": "Welcome Message",
30+
"tips.desktop.locomotion": "Locomotion",
31+
"tips.desktop.turning": "Turning",
32+
"tips.desktop.invite": "Invite",
33+
"tips.desktop.end": "End",
34+
"tips.desktop.menu": "Menu"
4035
};
36+
const steps = Object.keys(TOOLTIP_STEPS);
4137

4238
export const Tooltips = ({ step }) => <RoomLayout viewport={<Tooltip step={step} />} />;
4339

4440
Tooltips.argTypes = {
4541
step: {
4642
name: "Onboarding tips step",
47-
options: Object.keys(TOOLTIP_STEPS),
43+
options: steps,
4844
control: {
4945
type: "select",
5046
labels: TOOLTIP_STEPS
51-
},
52-
defaultValue: Object.keys(TOOLTIP_STEPS)[0]
47+
}
5348
}
5449
};
5550

51+
Tooltips.args = {
52+
step: steps[0]
53+
};
54+
5655
Tooltips.propTypes = {
5756
step: PropTypes.string
5857
};

src/react-components/ui-root.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1461,7 +1461,7 @@ class UIRoot extends Component {
14611461
onViewProfile={sessionId => this.setSidebar("user", { selectedUserId: sessionId })}
14621462
/>
14631463
)}
1464-
<NotificationsContainer>
1464+
<NotificationsContainer isMobile={isMobile}>
14651465
{showGlobalNotification && !this.state.globalNotificationDismissed && (
14661466
<SystemNotification
14671467
body={globalNotificationBody}

0 commit comments

Comments
 (0)