-
Notifications
You must be signed in to change notification settings - Fork 254
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
Add @aws-amplify/ui-standalone package #394
Conversation
Also,
|
import { Authenticator } from '@aws-amplify/ui-standalone'; | ||
import awsExports from '../../../environments/auth-with-username-no-attributes/src/aws-exports'; | ||
|
||
import '@aws-amplify/ui-react/styles.css'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should either be:
- Style injected (even for the react package perhaps?)
- Or be re-exported from the
ui-standalone
package. Since usage ofAuthenticator
from the standalone package should not involve pulling in something fromui-react
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-export is the way we've been going 👍
export class Authenticator { | ||
constructor(container: HTMLElement) { | ||
ReactDOM.render( | ||
<AuthenticatorComponent>{() => <h1>Howdy</h1>}</AuthenticatorComponent>, | ||
container | ||
); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great start! I am planning to make it more generic post this change gets merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious what the behavior should be render props for an imperative wrapper 🤔
Maybe:
new Authenticator(container).show().then(({ session, signOut, user }) => {
alert(`Howdy ${user.username}`)
});
Honestly, the "Vanilla Authenticator" example is a bit contrived – I don't have much customer data on what the use-cases are for this specifically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's pretty much the correct analogy. Treating the return value from the imperative wrapper as a ref
and acting accordingly would perhaps be the right usage.
As per our discussion, we could limit the scope of this package to say that it would only work with bundlers as described in the below doc too. |
Closed in favor of #712 |
Sync amplify-ui to amplify-ui-staging
Description of changes:
This was an attempt to use the
Authenticator
in a Vanilla JS context withaws-amplify
, but this is blocked by aws-amplify/amplify-js#9639.@aws-amplify/ui-standalone
@preact/compat
in place ofreact
andreact-dom
import * as React from 'react';
– this is required for aliasing to Preact to work!qrcode
for React to something that's browser-friendlyautoprefixer
because it's not browser-friendlyBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.