-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(theme): allow adding images as icons in features section (#188)
* feat(theme): allow adding images as icons in features section * Update home-page.md * Update home-page.md
- Loading branch information
Showing
7 changed files
with
65 additions
and
15 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
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
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
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
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
3 changes: 3 additions & 0 deletions
3
packages/island/src/theme-default/components/Image/index.module.scss
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,3 @@ | ||
.image { | ||
vertical-align: top; | ||
} |
23 changes: 23 additions & 0 deletions
23
packages/island/src/theme-default/components/Image/index.tsx
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,23 @@ | ||
import React from 'react'; | ||
import { DefaultTheme } from 'shared/types/default-theme'; | ||
import styles from './index.module.scss'; | ||
import { withBase } from '@runtime'; | ||
|
||
interface ImageProps { | ||
image: DefaultTheme.Image; | ||
alt?: string; | ||
width?: string; | ||
height: string; | ||
} | ||
|
||
export function Image(props: ImageProps) { | ||
const { image, alt, width, height } = props; | ||
|
||
return React.createElement('img', { | ||
className: styles.image, | ||
src: withBase(typeof image === 'string' ? image : image.src), | ||
alt: alt ?? (typeof image === 'string' ? '' : image.alt || ''), | ||
width, | ||
height | ||
}); | ||
} |
486e2ae
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
island – ./
island-navy.vercel.app
island-git-master-sanyuan0704.vercel.app
island-sanyuan0704.vercel.app
islandjs.dev
island-vercel.sanyuan0704.top