Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": "vr/JCeU5DXN3CeJIeLbZmr44rFnq+BGqQPng7kVxZGY=",
"shasum": "zWAvAKOxzUuZWjb75gYJw+izGqyBRcXoy2ocUCKMyGk=",
"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": "4diRqHxV2Sr2wHuyoP1dL/WcSbS6HSVzxkDL+Iv0JNM=",
"shasum": "i5/9SEgHydVQotkWZ7ErpPhOI2N7Cg3U+lbR5/ApQI4=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
7 changes: 6 additions & 1 deletion packages/snaps-sdk/src/jsx/components/Text.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,19 @@ describe('Text', () => {
});

it('renders text with props', () => {
const result = <Text size="sm">Hello world!</Text>;
const result = (
<Text size="sm" fontWeight="medium">
Hello world!
</Text>
);

expect(result).toStrictEqual({
type: 'Text',
key: null,
props: {
children: 'Hello world!',
size: 'sm',
fontWeight: 'medium',
},
});
});
Expand Down
1 change: 1 addition & 0 deletions packages/snaps-sdk/src/jsx/components/Text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export type TextProps = {
alignment?: 'start' | 'center' | 'end' | undefined;
color?: TextColors | undefined;
size?: 'sm' | 'md' | undefined;
fontWeight?: 'regular' | 'medium' | 'bold' | undefined;
};

const TYPE = 'Text';
Expand Down
3 changes: 3 additions & 0 deletions packages/snaps-sdk/src/jsx/validation.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,7 @@ describe('TextStruct', () => {
Hello, <Bold>world</Bold>
</Text>,
<Text size="sm">foo</Text>,
<Text fontWeight="medium">foo</Text>,
])('validates a text element', (value) => {
expect(is(value, TextStruct)).toBe(true);
});
Expand All @@ -1197,6 +1198,8 @@ describe('TextStruct', () => {
<Text />,
// @ts-expect-error - Invalid props.
<Text foo="bar">foo</Text>,
// @ts-expect-error - Invalid props.
<Text fontWeight="bar">foo</Text>,
<Box>
<Text>foo</Text>
</Box>,
Expand Down
3 changes: 3 additions & 0 deletions packages/snaps-sdk/src/jsx/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,9 @@ export const TextStruct: Describe<TextElement> = element('Text', {
]),
),
size: optional(nullUnion([literal('sm'), literal('md')])),
fontWeight: optional(
nullUnion([literal('regular'), literal('medium'), literal('bold')]),
),
});

/**
Expand Down
Loading