Skip to content

Releases: aws-amplify/amplify-ui

@aws-amplify/[email protected]

08 Apr 21:27
8b4e6e8
Compare
Choose a tag to compare

@aws-amplify/[email protected]

08 Apr 21:27
8b4e6e8
Compare
Choose a tag to compare

@aws-amplify/[email protected]

08 Apr 21:27
8b4e6e8
Compare
Choose a tag to compare

@aws-amplify/[email protected]

08 Apr 21:27
8b4e6e8
Compare
Choose a tag to compare

@aws-amplify/[email protected]

08 Apr 21:27
8b4e6e8
Compare
Choose a tag to compare

Patch Changes

  • #6504 e533dbbdade9d5ffdbd5aa7c446d958dd1980d43 Thanks @calebpollman! - feat(storage-browser): add defaultValue, value, and onValueChange props

    Controlled StorageBrowser

    'use client';
    
    import React from 'react';
    import { useRouter, usePathname, useSearchParams } from 'next/navigation';
    
    import { StorageBrowser } from '@aws-amplify/ui-react-storage';
    import { StorageBrowserEventValue } from '@aws-amplify/ui-react-storage/browser';
    
    export default function Page() {
      const router = useRouter();
      const pathname = usePathname();
      const params = useSearchParams();
    
      const value = params.get('value');
    
      const handleValueChange = React.useCallback(
        (nextValue: StorageBrowserEventValue) => {
          const nextParams = new URLSearchParams();
          nextParams.set('value', JSON.stringify(nextValue));
    
          router.push(`${pathname}?${nextParams.toString()}`);
        },
        [pathname, router]
      );
    
      return (
        <StorageBrowser
          onValueChange={handleValueChange}
          value={value ? JSON.parse(value) : null}
        />
      );
    }

    Initialize with defaultValue

    'use client';
    
    import { StorageBrowser } from '@aws-amplify/ui-react-storage';
    import { useSearchParams } from 'next/navigation';
    
    export default function Page() {
      const params = useSearchParams();
    
      const value = params.get('value');
    
      return <StorageBrowser defaultValue={value ? JSON.parse(value) : null} />;
    }
  • Updated dependencies [e4d8cc8c04dd428d38289085a9bf797b87c058a2, e533dbbdade9d5ffdbd5aa7c446d958dd1980d43]:

@aws-amplify/[email protected]

08 Apr 21:27
8b4e6e8
Compare
Choose a tag to compare

@aws-amplify/[email protected]

08 Apr 21:27
8b4e6e8
Compare
Choose a tag to compare

Minor Changes

Patch Changes

@aws-amplify/[email protected]

08 Apr 21:27
8b4e6e8
Compare
Choose a tag to compare

@aws-amplify/[email protected]

01 Apr 22:33
981ff0e
Compare
Choose a tag to compare

Minor Changes

@aws-amplify/[email protected]

01 Apr 22:33
981ff0e
Compare
Choose a tag to compare

Minor Changes

Patch Changes