Skip to content

Commit fc4a41d

Browse files
committed
fix: Restore Image component for svg and gif support
1 parent d04dcc4 commit fc4a41d

File tree

6 files changed

+77
-22
lines changed

6 files changed

+77
-22
lines changed

example/src/pages/creative_cloud/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: This is the home page of Creative Cloud
77

88
![Creative Cloud banner](images/cc-hero.png)
99

10-
![Creative Cloud icon](images/cc-icon.png)
10+
![Creative Cloud icon](https://adobe.io/shared/icons/cc_appicon_64.svg)
1111

1212
# Creativity for all
1313

@@ -44,7 +44,7 @@ Be sure to check out [Common Extensibility Platform (CEP)](https://www.adobe.io/
4444
When you're ready to ship, distribute your work on [Adobe Exchange](https://exchange.adobe.com/), the preferred marketplace for Adobe Creative Cloud users.
4545
And be sure to join the [Exchange Program for Creative Cloud](https://partners.adobe.com/exchangeprogram/creativecloud) to unlock more benefits, including streamlined publishing and promotional opportunities.
4646

47-
* ![Adobe Premiere Pro](images/pr-icon.png) [Adobe Premiere Pro](https://www.adobe.com/products/premiere.html)
47+
* ![Adobe Premiere Pro](https://adobe.io/shared/icons/pr_appicon_64.svg) [Adobe Premiere Pro](https://www.adobe.com/products/premiere.html)
4848
* ![Adobe InDesign](images/ai-icon.png) [Adobe InDesign](https://www.adobe.com/products/indesign.html)
4949
* ![Adobe After Effect](images/ae-icon.png) [Adobe After Effect](https://www.adobe.com/products/aftereffects.html)
5050

@@ -79,7 +79,7 @@ With the Cloud Content APIs, you can bring design work created in XD directly to
7979

8080
<TextBlock slots="image, heading, text, links" width="33%" theme="light" isCentered />
8181

82-
![MSFT Teams logo](images/msfteams.png)
82+
![CC logo](https://adobe.io/shared/icons/cc_appicon_64.svg)
8383

8484
### Microsoft teams
8585

@@ -121,7 +121,7 @@ Instantly share Creative Cloud files, designs, specs, and notifications all in r
121121
[Creative Cloud for a new era](https://www.youtube.com/watch?v=JemJbNJ4ZtU&ab_channel=AdobeCreativeCloud)
122122

123123
* ![Adobe](images/adobe.png)
124-
* ![Microsoft](images/msft.png)
124+
* ![CC](https://adobe.io/shared/icons/cc_appicon_64.svg)
125125

126126
### Partner Success Story
127127

@@ -247,7 +247,7 @@ Rob Kleiman, July 8th 2020
247247

248248
<ProductCard slots="icon, heading, text, buttons" theme="light" />
249249

250-
![CC icon](images/cc-icon.png)
250+
![CC icon](https://adobe.io/shared/icons/cc_appicon_64.svg)
251251

252252
#### CC Storage API
253253

example/src/products/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const products = [
4444
id: 0,
4545
name: 'Adobe Creative Cloud',
4646
description: 'Adobe Creative Cloud APIs and SDKs enable developers to impact creative work for millions of users worldwide. Build and distribute inspiring, productivity-driving plugins and integrations—all with Adobe Creative Cloud.',
47-
icon: CC,
47+
icon: 'https://adobe.io/shared/icons/cc_appicon_64.svg',
4848
discover: '/creative-cloud',
4949
docs: false,
5050
lastUpdated: '2020',

packages/gatsby-theme-aio/src/components/Contributors/index.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import React from 'react';
1414
import { css } from '@emotion/react';
15+
import { Image } from '../Image';
1516
import PropTypes from 'prop-types';
1617
import { getExternalLinkProps } from '../../utils';
1718

@@ -58,15 +59,11 @@ const Contributors = ({ repository, branch, root, pagePath, contributors = [], e
5859
height: var(--spectrum-global-dimension-size-400);
5960
border-radius: var(--spectrum-global-dimension-static-percent-50);
6061
background: var(--spectrum-global-color-gray-50);
62+
overflow: hidden;
6163
`}>
62-
<img
64+
<Image
6365
alt={contributor.name || contributor.login}
6466
src={`https://github.com/${contributor.login}.png`}
65-
css={css`
66-
width: var(--spectrum-global-dimension-size-400);
67-
height: var(--spectrum-global-dimension-size-400);
68-
border-radius: var(--spectrum-global-dimension-static-percent-50);
69-
`}
7067
/>
7168
</span>
7269
))}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright 2020 Adobe. All rights reserved.
3+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License. You may obtain a copy
5+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
*
7+
* Unless required by applicable law or agreed to in writing, software distributed under
8+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
* OF ANY KIND, either express or implied. See the License for the specific language
10+
* governing permissions and limitations under the License.
11+
*/
12+
13+
import React from 'react';
14+
import { css } from '@emotion/react';
15+
import { LARGE_SCREEN_WIDTH } from '../../utils';
16+
17+
export const Image = (props) => {
18+
// Check if gatsby-remark-images-remote processing was skipped
19+
if (!props.src || props.src.endsWith('.svg') || props.src.endsWith('.gif') || !props.loading) {
20+
// Defaults to same as gatsby-remark-images-remote loading config
21+
props.loading = props.loading || 'lazy';
22+
23+
// Recreate gatsby-remark-images-remote styles and classes
24+
return (
25+
<span
26+
className="gatsby-resp-image-wrapper"
27+
css={css`
28+
position: relative;
29+
display: block;
30+
margin-left: auto;
31+
margin-right: auto;
32+
max-width: ${LARGE_SCREEN_WIDTH};
33+
`}>
34+
<span
35+
className="gatsby-resp-image-background-image"
36+
css={css`
37+
display: block;
38+
position: relative;
39+
bottom: 0;
40+
left: 0;
41+
padding-bottom: 100%;
42+
`}
43+
/>
44+
<img
45+
{...props}
46+
className="gatsby-resp-image-image"
47+
css={css`
48+
width: 100%;
49+
height: 100%;
50+
margin: 0;
51+
vertical-align: middle;
52+
position: absolute;
53+
top: 0;
54+
left: 0;
55+
opacity: 0;
56+
transition: opacity 0.5s ease 0s;
57+
`}
58+
/>
59+
</span>
60+
);
61+
}
62+
63+
return <img {...props} />;
64+
};

packages/gatsby-theme-aio/src/components/MDXFilter/MDXComponents.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { Paragraph } from '../Paragraph';
1919
import { List } from '../List';
2020
import { Code } from '../Code';
2121
import { InlineCode } from '../InlineCode';
22+
import { Image } from '../Image';
2223
import { Table, TBody, Td, Th, THead, Tr } from '../Table';
2324

2425
export const MDXComponents = {
@@ -42,6 +43,7 @@ export const MDXComponents = {
4243
),
4344
inlineCode: InlineCode,
4445
a: AnchorLink,
46+
img: Image,
4547
table: Table,
4648
tbody: TBody,
4749
th: Th,

packages/gatsby-theme-aio/src/components/ProductCardGrid/index.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { Checkbox } from '../Checkbox';
1919
import { Picker } from '../Picker';
2020
import '@spectrum-css/typography';
2121
import '@spectrum-css/card';
22+
import { Image } from '../Image';
2223
import { LARGE_SCREEN_WIDTH } from '../../utils';
2324
import PropTypes from 'prop-types';
2425

@@ -237,16 +238,7 @@ const ProductCardGrid = ({
237238
width: var(--spectrum-global-dimension-size-600);
238239
margin-bottom: var(--spectrum-global-dimension-size-200);
239240
`}>
240-
<img
241-
css={css`
242-
display: block;
243-
height: 100%;
244-
object-fit: contain;
245-
`}
246-
src={product.icon}
247-
alt=""
248-
aria-hidden="true"
249-
/>
241+
<Image src={product.icon} aria-hidden="true" alt="" />
250242
</div>
251243
)}
252244
</div>

0 commit comments

Comments
 (0)