-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #684 from carbon-design-system/fix/storybook-images
fix: nextjs images in storybook
- Loading branch information
Showing
4 changed files
with
30 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright IBM Corp. 2022, 2022 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import clsx from 'clsx' | ||
|
||
// `node_modules` import is necessary to not create a cyclically resolving alias | ||
import Image from '../../../node_modules/next/image' | ||
import styles from './next-image.module.scss' | ||
|
||
const NextImage = (props) => { | ||
const modifiedProps = { ...props, layout: 'fill' } | ||
|
||
delete modifiedProps.className | ||
delete modifiedProps.placeholder | ||
|
||
return ( | ||
<div className={clsx(styles['image-container'], props.className)}> | ||
<Image {...modifiedProps} className={styles.image} unoptimized /> | ||
</div> | ||
) | ||
} | ||
|
||
export default NextImage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters