-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat(ui): TextInput updates #1942
Merged
+172
−248
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cebb469
feat: update TextInput styles
VanishMax acd320d
feat: add `variant` property to Text component, simplify code
VanishMax e1553f0
feat(ui): add `variant` prop to Density component
VanishMax 0525795
fix(ui): match AddressView with the latest styles
VanishMax 56146cf
chore: changeset
VanishMax File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@penumbra-zone/ui': minor | ||
--- | ||
|
||
Sync TextInput with the latest designs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,142 +1,26 @@ | ||
/** | ||
* Utility interface to be used below to ensure that only one text type is used | ||
* at a time. | ||
*/ | ||
interface NeverTextTypes { | ||
h1?: never; | ||
h2?: never; | ||
h3?: never; | ||
h4?: never; | ||
xxl?: never; | ||
large?: never; | ||
p?: never; | ||
strong?: never; | ||
detail?: never; | ||
xxs?: never; | ||
small?: never; | ||
detailTechnical?: never; | ||
technical?: never; | ||
body?: never; | ||
} | ||
export type TextVariant = | ||
| 'h1' | ||
| 'h2' | ||
| 'h3' | ||
| 'h4' | ||
| 'xxl' | ||
| 'large' | ||
| 'p' | ||
| 'strong' | ||
| 'detail' | ||
| 'xxs' | ||
| 'small' | ||
| 'detailTechnical' | ||
| 'technical' | ||
| 'body'; | ||
|
||
export type TextType = | ||
| (Omit<NeverTextTypes, 'h1'> & { | ||
/** | ||
* Renders a styled `<h1 />`. Pass the `as` prop to use a different HTML | ||
* element with the same styling. | ||
*/ | ||
h1: true; | ||
}) | ||
| (Omit<NeverTextTypes, 'h2'> & { | ||
/** | ||
* Renders a styled `<h2 />`. Pass the `as` prop to use a different HTML | ||
* element with the same styling. | ||
*/ | ||
h2: true; | ||
}) | ||
| (Omit<NeverTextTypes, 'h3'> & { | ||
/** | ||
* Renders a styled `<h3 />`. Pass the `as` prop to use a different HTML | ||
* element with the same styling. | ||
*/ | ||
h3: true; | ||
}) | ||
| (Omit<NeverTextTypes, 'h4'> & { | ||
/** | ||
* Renders a styled `<h4 />`. Pass the `as` prop to use a different HTML | ||
* element with the same styling. | ||
*/ | ||
h4: true; | ||
}) | ||
| (Omit<NeverTextTypes, 'xxl'> & { | ||
/** | ||
* Renders bigger text used for section titles. Renders a `<span />` by | ||
* default; pass the `as` prop to use a different HTML element with the | ||
* same styling. | ||
*/ | ||
xxl: true; | ||
}) | ||
| (Omit<NeverTextTypes, 'large'> & { | ||
/** | ||
* Renders big text used for section titles. Renders a `<span />` by | ||
* default; pass the `as` prop to use a different HTML element with the | ||
* same styling. | ||
*/ | ||
large: true; | ||
}) | ||
| (Omit<NeverTextTypes, 'p'> & { | ||
/** | ||
* Renders a styled `<p />` tag with a bottom-margin (unless it's the last | ||
* child). Aside from the margin, `<P />` is identical to `<Body />`. | ||
* | ||
* Note that this is the only component in the entire Penumbra UI library | ||
* that renders an external margin. It's a convenience for developers who | ||
* don't want to wrap each `<Text p />` in a `<div />` with the | ||
* appropriate margin, or a flex columnn with a gap. | ||
*/ | ||
p: true; | ||
}) | ||
| (Omit<NeverTextTypes, 'strong'> & { | ||
/** | ||
* Emphasized body text. | ||
* | ||
* Renders a `<span />` by default; pass the `as` prop to use a different | ||
* HTML element with the same styling. | ||
*/ | ||
strong: true; | ||
}) | ||
| (Omit<NeverTextTypes, 'detail'> & { | ||
/** | ||
* Detail text used for small bits of tertiary information. | ||
* | ||
* Renders a `<span />` by default; pass the `as` prop to use a different | ||
* HTML element with the same styling. | ||
*/ | ||
detail: true; | ||
}) | ||
| (Omit<NeverTextTypes, 'xxs'> & { | ||
/** | ||
* xxs text used for extra small bits of tertiary information. | ||
* | ||
* Renders a `<span />` by default; pass the `as` prop to use a different | ||
* HTML element with the same styling. | ||
*/ | ||
xxs: true; | ||
}) | ||
| (Omit<NeverTextTypes, 'small'> & { | ||
/** | ||
* Small text used for secondary information. | ||
* | ||
* Renders a `<span />` by default; pass the `as` prop to use a different | ||
* HTML element with the same styling. | ||
*/ | ||
small: true; | ||
}) | ||
| (Omit<NeverTextTypes, 'detailTechnical'> & { | ||
/** | ||
* Small monospaced text used for code, values, and other technical | ||
* information. | ||
* | ||
* Renders a `<span />` by default; pass the `as` prop to use a different | ||
* HTML element with the same styling. | ||
*/ | ||
detailTechnical: true; | ||
}) | ||
| (Omit<NeverTextTypes, 'technical'> & { | ||
/** | ||
* Monospaced text used for code, values, and other technical information. | ||
* | ||
* Renders a `<span />` by default; pass the `as` prop to use a different | ||
* HTML element with the same styling. | ||
*/ | ||
technical: true; | ||
}) | ||
| (Omit<NeverTextTypes, 'body'> & { | ||
/** | ||
* Body text used throughout most of our UIs. | ||
* | ||
* Renders a `<span />` by default; pass the `as` prop to use a different | ||
* HTML element with the same styling. | ||
*/ | ||
body?: true; | ||
}); | ||
type TextType = { | ||
[K in TextVariant]: Record<K, true> & Partial<Record<Exclude<TextVariant, K>, never>>; | ||
}[TextVariant]; | ||
|
||
export type TypographyProps = | ||
| (TextType & { variant?: never }) | ||
| { | ||
/** dynamic typography variant as a string: `'h1' | 'body' | 'large' | 'p' | 'strong' | etc. */ | ||
variant?: TextVariant; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
praise: variant property on density is a nice feature