Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Commit 8339f6f

Browse files
authored
add typings (#147)
1 parent 103cafb commit 8339f6f

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

src/components/Image/Image.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ import { customPropTypes, UIComponent } from '../../lib'
55
import { ImageBehavior } from '../../lib/accessibility'
66
import { Accessibility } from '../../lib/accessibility/interfaces'
77

8+
import { ComponentVariablesInput, IComponentPartStylesInput } from '../../../types/theme'
9+
import { Extendable, ReactChildren } from '../../../types/utils'
10+
11+
export interface IImageProps {
12+
accessibility?: Accessibility
13+
as?: any
14+
avatar?: boolean
15+
children?: ReactChildren
16+
circular?: boolean
17+
className?: string
18+
fluid?: boolean
19+
styles?: IComponentPartStylesInput
20+
variables?: ComponentVariablesInput
21+
}
22+
823
/**
924
* An image is a graphic representation of something.
1025
* @accessibility
@@ -18,7 +33,7 @@ import { Accessibility } from '../../lib/accessibility/interfaces'
1833
* - when image has role='presentation' then screen readers navigate to the element in scan/virtual mode. To avoid this, the attribute "aria-hidden='true'" is applied by the default image behavior
1934
* - when alt property is used in combination with aria-label, arialabbeledby or title, additional screen readers verification is needed as each screen reader handles this combination differently.
2035
*/
21-
class Image extends UIComponent<any, any> {
36+
class Image extends UIComponent<Extendable<IImageProps>, any> {
2237
static className = 'ui-image'
2338

2439
static displayName = 'Image'

src/themes/teams/components/Image/imageStyles.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { pxToRem } from '../../../../lib'
22
import { ICSSInJSStyle } from '../../../../../types/theme'
3+
import { IImageProps } from '../../../../components/Image/Image'
34

45
export default {
5-
root: ({ props, variables }): ICSSInJSStyle => ({
6+
root: ({ props, variables }: { props: IImageProps; variables: any }): ICSSInJSStyle => ({
67
display: 'inline-block',
78
verticalAlign: 'middle',
89
width: (props.fluid && '100%') || variables.width,

0 commit comments

Comments
 (0)