Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gatsby-plugin-image): Rename hooks #29462

Merged
merged 1 commit into from
Feb 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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