GetJobber / atlantis

🔱 Atlantis
https://atlantis.getjobber.com
MIT License
25 stars 30 forks source link

feat(components): Update positioning of dropzone content #1978

Closed taylorvnoj closed 1 month ago

taylorvnoj commented 1 month ago

Motivations

When InputFile is within a tall container and is stretched to fill the space, the dropzone content (Button, hintText) should be centered vertically and horizontally.

Changes

Added

Changed

Instead of the dropzone content sticking to the top of a tall InputFile, that content is now in the center.

Before

Screenshot 2024-08-07 at 8 51 33 PM

After

Screenshot 2024-08-07 at 8 39 03 PM

If the InputFile is set to size="small" (so only a button shows up), this is what we see:

Screenshot 2024-08-07 at 8 54 33 PM

Note that any InputFile not stretched within a tall container retains the same styling as before:

Screenshot 2024-08-07 at 8 56 25 PM

Testing

Pre-release showing prod example will be in separate PR tagged in slack msg

To see this in storybook, update the StatefulTemplate in docs/components/InputFile/Web.stories.tsx and see the screenshots above:

const StatefulTemplate: ComponentStory<typeof InputFile> = args => {
  const [files, setFiles] = useState<FileUpload[]>([]);

  return (
      <>
      <div style={{ height: '220px', width: '620px', display: 'flex', flexDirection: 'column' }}>
        <div style={{ flexGrow: 1, display: 'flex' }}>
        <InputFile
          {...args}
          onUploadStart={handleUpload}
          onUploadProgress={handleUpload}
          onUploadComplete={handleUpload}
          style={{ flexGrow: 1 }}
        />
        </div>
        </div>
        {files.map(file => (
          <FormatFile file={file} key={file.key} />
        ))}
      </>
  );

  function handleUpload(file: FileUpload) {
    setFiles(oldFiles => updateFiles(file, oldFiles));
  }
};

Changes can be tested via Pre-release


In Atlantis we use Github's built in pull request reviews.

Random photo of Atlantis

cloudflare-workers-and-pages[bot] commented 1 month ago

Deploying atlantis with  Cloudflare Pages  Cloudflare Pages

Latest commit: 546776c
Status: ✅  Deploy successful!
Preview URL: https://65b34d53.atlantis.pages.dev
Branch Preview URL: https://taylor-inputfile-changes.atlantis.pages.dev

View logs

github-actions[bot] commented 1 month ago

Published Pre-release for 546776c29fb84ff4b93e456ef065161a2a9d8cb7 with versions:

  - @jobber/components@5.21.4-TAYLORinp.2+546776c2

To install the new version(s) for Web run:

npm install @jobber/components@5.21.4-TAYLORinp.2+546776c2