Skip to content

Commit 155bb78

Browse files
committed
Scene UI: fixes attributions for a remixed scene & adds Storybook story
Why: the attributions for a remixed scene were neither fully tested nor fully working
1 parent c1a3c64 commit 155bb78

File tree

2 files changed

+32
-18
lines changed

2 files changed

+32
-18
lines changed

src/react-components/scene-ui.js

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,26 @@ class SceneUI extends Component {
8787
source = url && url.includes("sketchfab.com") ? "Sketchfab" : "";
8888

8989
if (remix) {
90-
<span className="remix">
91-
<FormattedMessage
92-
id="scene-page.remix-attribution"
93-
defaultMessage="(Remixed from <a>{name} by {author}</a>)"
94-
values={{
95-
name: _name,
96-
author: _author,
97-
a: chunks =>
98-
url ? (
99-
<a href={url} target="_blank" rel="noopener noreferrer">
100-
{chunks}
101-
</a>
102-
) : (
103-
<>{chunks}</>
104-
)
105-
}}
106-
/>
107-
</span>;
90+
return (
91+
<span className="remix">
92+
<FormattedMessage
93+
id="scene-page.remix-attribution"
94+
defaultMessage="(Remixed from <a>{name} by {author}</a>)"
95+
values={{
96+
name: _name,
97+
author: _author,
98+
a: chunks =>
99+
url ? (
100+
<a href={url} target="_blank" rel="noopener noreferrer">
101+
{chunks}
102+
</a>
103+
) : (
104+
<>{chunks}</>
105+
)
106+
}}
107+
/>
108+
</span>
109+
);
108110
} else if (source) {
109111
return (
110112
<span key={url}>

src/react-components/scene-ui.stories.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,15 @@ export const ShowUnavailable = () => (
6060
unavailable={true}
6161
/>
6262
);
63+
64+
export const RemixedScene = () => (
65+
<SceneUI
66+
sceneName="Child Scene"
67+
sceneDescription="immature"
68+
sceneScreenshotURL="https://example.com/"
69+
sceneAttributions={{
70+
creator: "Derivative Artist"
71+
}}
72+
parentScene={{ name: "Parent Scene", url: "https://example.test", attributions: { creator: "Über Artist" } }}
73+
/>
74+
);

0 commit comments

Comments
 (0)