-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Text implementation #18590
Merged
andrefcdias
merged 33 commits into
microsoft:master
from
andrefcdias:text-implementation
Jul 2, 2021
Merged
Text implementation #18590
Changes from 24 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
1b8191b
Regenerate package
andrefcdias ce22d98
Change files
andrefcdias 617dc75
Migrate package to new converged DX
andrefcdias 21b7d69
Make package private
andrefcdias 2da22fc
Add Text component
andrefcdias 9f91bd0
Merge branch 'master' into text-implementation
andrefcdias 9f35426
Add as, wrap and truncate tests
andrefcdias d97b9e8
Added block styling prop
tringakrasniqi f415622
Added italic style prop
tringakrasniqi c0a327d
Added underline style prop
tringakrasniqi 19fd891
Added strikethrough style prop
tringakrasniqi c4fe9d9
Added test for multiple style props
tringakrasniqi 817d4ee
Add strikethrough + underline styling
andrefcdias 01a372a
Add size prop
andrefcdias 89d134a
Add font prop
andrefcdias ac4226a
Add font prop
andrefcdias d2d9d91
Add align prop
andrefcdias 80e440b
Update types
andrefcdias d57740d
Fix base story
andrefcdias 79c469d
Added storybook stories for Text props
tringakrasniqi 1c85eba
Changed storybook story with arg controls
tringakrasniqi f73f6c0
Add documentation for props
andrefcdias 31b5d3c
Limit as prop to specific semantic elements
andrefcdias 27f7cb5
Update API doc
andrefcdias 30b790e
Move default of as prop to the hook
andrefcdias 549cd3a
Remove as prop test
andrefcdias 0d871f0
Update packages/react-text/src/components/Text/useTextStyles.ts
andrefcdias d1db833
Merge branch 'master' into text-implementation
andrefcdias f059503
Update API docs
andrefcdias e6d24b0
Remove as prop test
andrefcdias 94c2c1c
Remove useless comments
andrefcdias 85dac23
Fix API docs (again)
andrefcdias 2f5cd4e
Merge branch 'master' into text-implementation
andrefcdias 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
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { makeStyles } from '@fluentui/react-make-styles'; | ||
import * as React from 'react'; | ||
import { Text } from './Text'; | ||
import { TextProps } from './Text.types'; | ||
|
||
const useStyles = makeStyles({ | ||
container: { | ||
width: '100px', | ||
}, | ||
}); | ||
|
||
export const TextStory = (props: TextProps) => { | ||
const styles = useStyles(); | ||
return ( | ||
<div className={styles.container}> | ||
<Text {...props}>This is an example of the Text component's usage.</Text> | ||
</div> | ||
); | ||
}; | ||
|
||
TextStory.argTypes = { | ||
wrap: { | ||
defaultValue: true, | ||
control: 'boolean', | ||
}, | ||
truncate: { | ||
defaultValue: false, | ||
control: 'boolean', | ||
}, | ||
underline: { | ||
defaultValue: false, | ||
control: 'boolean', | ||
}, | ||
block: { | ||
defaultValue: false, | ||
control: 'boolean', | ||
}, | ||
italic: { | ||
defaultValue: false, | ||
control: 'boolean', | ||
}, | ||
strikethrough: { | ||
defaultValue: false, | ||
control: 'boolean', | ||
}, | ||
size: { | ||
defaultValue: 300, | ||
type: { name: 'number', required: false }, | ||
control: { | ||
type: 'select', | ||
options: [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000], | ||
}, | ||
}, | ||
font: { | ||
defaultValue: 'base', | ||
type: { name: 'string', required: false }, | ||
control: { | ||
type: 'select', | ||
options: ['base', 'monospace', 'numeric'], | ||
}, | ||
}, | ||
weight: { | ||
defaultValue: 'regular', | ||
type: { name: 'string', required: false }, | ||
control: { | ||
type: 'select', | ||
options: ['regular', 'medium', 'semibold'], | ||
}, | ||
}, | ||
align: { | ||
defaultValue: 'start', | ||
type: { name: 'string', required: false }, | ||
control: { | ||
type: 'select', | ||
options: ['start', 'center', 'end', 'justify'], | ||
}, | ||
}, | ||
}; | ||
|
||
export default { | ||
title: 'Components/Text', | ||
component: Text, | ||
}; |
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
11 changes: 11 additions & 0 deletions
11
packages/react-text/src/components/Text/__snapshots__/Text.test.tsx.snap
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,11 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Text renders a default state 1`] = ` | ||
<div> | ||
<span | ||
class="" | ||
> | ||
Test | ||
</span> | ||
</div> | ||
`; |
Oops, something went wrong.
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.
the controls should be generated from types, or did I not understand smth @Hotell ?
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.
AFAIK this needs to be duplicated for compatibility reasons.