Skip to content

Commit

Permalink
Add loading variant to old button
Browse files Browse the repository at this point in the history
  • Loading branch information
david0xd committed Dec 9, 2024
1 parent 0b91ace commit d6ecd72
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/examples/packages/bip32/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "hRuh420QB8uksiS3rFwrvqNoQD5XTH/QyWkhFkmNBD8=",
"shasum": "wvItJBAL+To/LRiET0hoeTHchcoc/67OZf3d3fZRSx0=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/bip44/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "kztNgPuBct9iJIGhWZs2i/yluGPJSQi0xl5+00opVGs=",
"shasum": "lNTBthbBZXfpL7IKOchQcu7o3w79o0leXZnrJsTmNqQ=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "Ezgekk8R9FYAZJM3/BMlFrV5f03DueKtm+uWQI/ekgQ=",
"shasum": "w8ZPchwG+LqlFzbmkqVQ5nDqt5GDFkZsU8dUm1b5NXo=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/browserify/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "gmim/O6MOkQRLCtPc4mJh0PtSUi+CICb+4+cp6gTX5Y=",
"shasum": "cekcKLYno5G+cLUUsfxXHpvz+B8x/woWZ8PgDsK5VkM=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/cronjobs/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "ZjF3VIQyyZMjs7bCHZHcBqkkM4mxQjAHhxURv3bNdIg=",
"shasum": "lBiyF1iYoelw+RiOjct3Bg+JglJWZHxwbAvibK43Zv4=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/dialogs/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "Mo4tLj3FLGjTrODhiznPVbTmqLdghRqKWaAEhPUmBmg=",
"shasum": "c7cbaBY5NK97dUF5sBtdPpggopBGodqHXZf6I2zcwas=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/ethers-js/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "kgnGTfsOQs26Kb8oopMnEvXPmbOeDqy0BllLa9z5GCM=",
"shasum": "SFJepq0B6/idN8MNTB7ynSvYEWAwXZNg4ADVbp7X6mk=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/get-entropy/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "i70snr3mPw7knx20YaN64bYsJjEgaqNNDl01oFi4Bo4=",
"shasum": "5j9zhSuGBqFioXLJffAkm1bSPmGM/8MZPiXfsQXoJ88=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/images/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "KJTZWGggYaU8C3LnOd9CodSJoIMtvzkNKC5bzfMPg4M=",
"shasum": "9KrhQU4Gjrw3B0lFVXx1nITRJIyXzDkOMQMKU9YAfWc=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "g0lygIry0x1ULrACMgFTncUXfstO2l+7iM7/D65BXqY=",
"shasum": "tU0G6gMy1ps7Bto1LuRGCA7pzf2fb38beJypAiht/FY=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "hlMIB9kls/72D0A77vdvIkZEbJNUDj3Py9PIxm7aWOM=",
"shasum": "triP7af/N+IxfSBDbQ8K/TDD5wePm2Nx+ywOGljlToo=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "oKKYF+AERJAyRBABHRf4nsfQ6IrhKele+Fei+JXxGzA=",
"shasum": "tp4cz9UpX+/BJda+tQM0Go4V2iq4529PoEm9dguiA9o=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
2 changes: 2 additions & 0 deletions packages/snaps-sdk/src/ui/components/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { LiteralStruct, NodeType } from '../nodes';
export enum ButtonVariant {
Primary = 'primary',
Secondary = 'secondary',
Loading = 'loading',
}

export enum ButtonType {
Expand All @@ -31,6 +32,7 @@ export const ButtonStruct = assign(
union([
enumValue(ButtonVariant.Primary),
enumValue(ButtonVariant.Secondary),
enumValue(ButtonVariant.Loading),
]),
),
buttonType: optional(
Expand Down
6 changes: 5 additions & 1 deletion packages/snaps-utils/src/ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@ const ALLOWED_PROTOCOLS = ['https:', 'mailto:', 'metamask:'];
* @param variant - The legacy button component variant.
* @returns The button variant.
*/
function getButtonVariant(variant?: 'primary' | 'secondary' | undefined) {
function getButtonVariant(
variant?: 'primary' | 'secondary' | 'loading' | undefined,
) {
switch (variant) {
case 'primary':
return 'primary';
case 'secondary':
return 'destructive';
case 'loading':
return 'loading';
default:
return undefined;
}
Expand Down

0 comments on commit d6ecd72

Please sign in to comment.