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

Update README/docs to omit picture() usage w/ Node/React #32

Open
aflansburg opened this issue Jan 5, 2021 · 1 comment
Open

Update README/docs to omit picture() usage w/ Node/React #32

aflansburg opened this issue Jan 5, 2021 · 1 comment

Comments

@aflansburg
Copy link

aflansburg commented Jan 5, 2021

adaptive/source/tree.ts only exports one method which is makePictureTree()

export const makePictureTree = (handle?: FileHandle, opts?: PictureOptions): Picture => {

However, README references a picture() method. I haven't delved too much into this so excuse my poor usage of the utility as far as options go but it appears I can do:

<GridList cellHeight={160} cols={3}>
      {hits
        .filter(hit => !hit.filename.toLowerCase().includes('heic'))
        .map(tile => {
          const options = {
            sizes: { fallback: '20vw' },
            resolutions: [540, 1080]
          };
          const tree = makePictureTree(tile.objectID, options);
          console.log(tree);
          const renderImage = imageObj => <img alt={tile.filename} {...imageObj} />;
          return (
            <GridListTile key={tile.image} cols={1} style={{ minHeight: 250 }}>
              <picture>{renderImage(tree.img)}</picture>
            </GridListTile>
          );
        })}
    </GridList>

Using Material UI GridList and Algolia React InstantSearch currently in a test project.

@geeosh
Copy link

geeosh commented Mar 1, 2023

@aflansburg adaptive/src/index.ts exports the fsAdaptive constant, which is defined as: fsAdaptive = { picture }

So you can import the picture function this way:

import { fsAdaptive } from 'filestack-adaptive'
const { picture } = fsAdaptive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants