forked from microsoft/fluentui
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Button: Migrate react-button to new DX (microsoft#18607)
#### Pull request checklist - [x] Addresses an existing issue: Fixes part of microsoft#18579 - [x] Include a change request file using `$ yarn change` #### Description of changes - migrates `react-button` package using `yarn nx workspace-generator migrate-converged-pkg` - moved `Playground.tsx` and `Playground.types.tsx` to `react-button` package as they were deleted by migration script. - updates `useCompountButtonStyles` to explicitly declare `marginTop` value to fix babel-loader error. - extracted `buttonBaseProps` from `Button` story to its own file. - updated import paths for all Button stories.
- Loading branch information
1 parent
b771790
commit 97c1a55
Showing
23 changed files
with
258 additions
and
81 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-button-1b2e69bc-f82f-49a8-a211-b843e3bef591.json
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,7 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "Button: Migrate to new dx", | ||
"packageName": "@fluentui/react-button", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-examples-28ae56c7-be37-496c-a550-ccfd1b3180c6.json
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,7 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Button: Migrate to new dx", | ||
"packageName": "@fluentui/react-examples", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
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,11 @@ | ||
const rootMain = require('../../../.storybook/main'); | ||
|
||
module.exports = /** @type {Pick<import('../../../.storybook/main').StorybookConfig,'addons'|'stories'|'webpackFinal'>} */ ({ | ||
stories: [...rootMain.stories, '../src/**/*.stories.mdx', '../src/**/*.stories.@(ts|tsx)'], | ||
addons: [...rootMain.addons], | ||
webpackFinal: (config, options) => { | ||
const localConfig = { ...rootMain.webpackFinal(config, options) }; | ||
|
||
return localConfig; | ||
}, | ||
}); |
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,3 @@ | ||
import * as rootPreview from '../../../.storybook/preview'; | ||
|
||
export const decorators = [...rootPreview.decorators]; |
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,9 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"checkJs": true | ||
}, | ||
"exclude": ["../**/*.test.ts", "../**/*.test.js", "../**/*.test.tsx", "../**/*.test.jsx"], | ||
"include": ["../src/**/*", "*.js"] | ||
} |
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 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", | ||
"extends": "./api-extractor.json", | ||
"mainEntryPointFilePath": "<projectFolder>/dist/<unscopedPackageName>/src/index.d.ts" | ||
} |
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,9 +1,21 @@ | ||
const { createConfig } = require('@fluentui/scripts/jest/jest-resources'); | ||
const path = require('path'); | ||
// @ts-check | ||
|
||
const config = createConfig({ | ||
setupFiles: [path.resolve(path.join(__dirname, 'config', 'tests.js'))], | ||
/** | ||
* @type {jest.InitialOptions} | ||
*/ | ||
module.exports = { | ||
displayName: 'react-button', | ||
preset: '../../jest.preset.js', | ||
globals: { | ||
'ts-jest': { | ||
tsConfig: '<rootDir>/tsconfig.json', | ||
diagnostics: false, | ||
}, | ||
}, | ||
transform: { | ||
'^.+\\.tsx?$': 'ts-jest', | ||
}, | ||
coverageDirectory: './coverage', | ||
setupFilesAfterEnv: ['./config/tests.js'], | ||
snapshotSerializers: ['@fluentui/jest-serializer-make-styles'], | ||
}); | ||
|
||
module.exports = config; | ||
}; |
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
2 changes: 0 additions & 2 deletions
2
...ples/src/react-button/Playground.types.ts → ...ct-button/src/Playground.types.stories.ts
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,25 @@ | ||
import { ButtonProps } from './Button'; | ||
import { PropDefinition } from './Playground.types.stories'; | ||
|
||
type ExampleProps = { iconOnly?: string }; | ||
|
||
export const buttonBaseProps: PropDefinition<ButtonProps & ExampleProps>[] = [ | ||
{ propName: 'block', propType: 'boolean' }, | ||
{ propName: 'circular', propType: 'boolean' }, | ||
{ propName: 'content', propType: 'string', defaultValue: 'This is a button', dependsOnProps: ['~iconOnly'] }, | ||
{ propName: 'disabled', propType: 'boolean', dependsOnProps: ['~disabledFocusable'] }, | ||
{ propName: 'disabledFocusable', propType: 'boolean', dependsOnProps: ['~disabled'] }, | ||
{ propName: 'icon', propType: 'boolean' }, | ||
{ propName: 'iconOnly', propType: 'boolean', dependsOnProps: ['icon'] }, | ||
{ | ||
propName: 'iconPosition', | ||
propType: ['before', 'after'], | ||
defaultValue: 'before', | ||
dependsOnProps: ['icon', '~iconOnly'], | ||
}, | ||
{ propName: 'outline', propType: 'boolean', dependsOnProps: ['~primary', '~subtle', '~transparent'] }, | ||
{ propName: 'primary', propType: 'boolean', dependsOnProps: ['~outline', '~subtle', '~transparent'] }, | ||
{ propName: 'size', propType: ['small', 'medium', 'large'], defaultValue: 'medium' }, | ||
{ propName: 'subtle', propType: 'boolean', dependsOnProps: ['~outline', '~primary', '~transparent'] }, | ||
{ propName: 'transparent', propType: 'boolean', dependsOnProps: ['~outline', '~primary', '~subtle'] }, | ||
]; |
Oops, something went wrong.