Skip to content

Commit

Permalink
fix(gatsby-plugin-image): Rename hooks (#29462)
Browse files Browse the repository at this point in the history
  • Loading branch information
ascorbic committed Feb 11, 2021
1 parent 6b93c1c commit 4638cd6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions packages/gatsby-plugin-image/src/components/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export interface IUrlBuilderArgs<OptionsType> {
format: ImageFormat
options: OptionsType
}
export interface IUseGatsbyImageArgs<OptionsType = {}> {
export interface IGetImageDataArgs<OptionsType = {}> {
baseUrl: string
/**
* For constrained and fixed images, the size of the image element
Expand Down Expand Up @@ -145,7 +145,7 @@ export interface IUseGatsbyImageArgs<OptionsType = {}> {
/**
* Use this hook to generate gatsby-plugin-image data in the browser.
*/
export function useGatsbyImage<OptionsType>({
export function getImageData<OptionsType>({
baseUrl,
urlBuilder,
sourceWidth,
Expand All @@ -155,7 +155,7 @@ export function useGatsbyImage<OptionsType>({
breakpoints = EVERY_BREAKPOINT,
options,
...props
}: IUseGatsbyImageArgs<OptionsType>): IGatsbyImageData {
}: IGetImageDataArgs<OptionsType>): IGatsbyImageData {
const generateImageSource = (
baseUrl: string,
width: number,
Expand Down Expand Up @@ -393,7 +393,7 @@ export interface IArtDirectedImage {
* @param artDirected Array of objects which each contains a `media` string which is a media query
* such as `(min-width: 320px)`, and the image object to use when that query matches.
*/
export function useArtDirection(
export function withArtDirection(
defaultImage: IGatsbyImageData,
artDirected: Array<IArtDirectedImage>
): IGatsbyImageData {
Expand Down
6 changes: 3 additions & 3 deletions packages/gatsby-plugin-image/src/index.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ export { LaterHydrator } from "./components/later-hydrator"
export {
getImage,
getSrc,
useGatsbyImage,
useArtDirection,
getImageData,
withArtDirection,
IArtDirectedImage,
IUseGatsbyImageArgs,
IGetImageDataArgs,
IUrlBuilderArgs,
} from "./components/hooks"
export {
Expand Down
6 changes: 3 additions & 3 deletions packages/gatsby-plugin-image/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ export { StaticImage } from "./components/static-image.server"
export {
getImage,
getSrc,
useGatsbyImage,
useArtDirection,
getImageData,
withArtDirection,
IArtDirectedImage,
IUseGatsbyImageArgs,
IGetImageDataArgs,
IUrlBuilderArgs,
} from "./components/hooks"
export {
Expand Down

0 comments on commit 4638cd6

Please sign in to comment.