-
-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7949cf5
commit 936192f
Showing
70 changed files
with
1,255 additions
and
1,140 deletions.
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 was deleted.
Oops, something went wrong.
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,10 @@ | ||
module.exports = { | ||
singleQuote: true, | ||
trailingComma: 'all', | ||
printWidth: 100, | ||
overrides: [{ files: '.prettierrc', options: { parser: 'json' } }], | ||
plugins: [ | ||
require.resolve('prettier-plugin-packagejson'), | ||
require.resolve('prettier-plugin-organize-imports'), | ||
], | ||
}; |
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
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
49 changes: 48 additions & 1 deletion
49
packages/zarm/src/action-sheet/__tests__/__snapshots__/index.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 |
---|---|---|
@@ -1,3 +1,50 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`ActionSheet renders correctly 1`] = `<DocumentFragment />`; | ||
exports[`ActionSheet renders correctly 1`] = ` | ||
<DocumentFragment> | ||
<div | ||
class="za-mask " | ||
style="background-color: rgba(0, 0, 0, 0.55);" | ||
/> | ||
<div | ||
class="za-popup__wrapper" | ||
> | ||
<div | ||
class="za-popup za-popup--bottom " | ||
> | ||
<div | ||
class="za-action-sheet" | ||
> | ||
<div | ||
class="za-action-sheet__actions" | ||
> | ||
<div | ||
class="za-action-sheet__item" | ||
> | ||
操作一 | ||
</div> | ||
<div | ||
class="za-action-sheet__item" | ||
> | ||
操作二 | ||
</div> | ||
<div | ||
class="za-action-sheet__item za-action-sheet__item--danger" | ||
> | ||
操作三 | ||
</div> | ||
</div> | ||
<div | ||
class="za-action-sheet__cancel" | ||
> | ||
<div | ||
class="za-action-sheet__item za-action-sheet__item--bold" | ||
> | ||
取消 | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</DocumentFragment> | ||
`; |
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,49 +1,7 @@ | ||
import * as React from 'react'; | ||
import { renderImperatively } from '../utils/dom'; | ||
import ActionSheet, { ActionSheetProps } from './ActionSheet'; | ||
import renderToContainer from '../utils/renderToContainer'; | ||
import { RuntimeConfigProvider } from '../config-provider/ConfigProvider'; | ||
|
||
interface ActionSheetRef { | ||
close: () => void; | ||
} | ||
|
||
export const show = (props: Omit<ActionSheetProps, 'visible'>) => { | ||
let unmount = () => {}; | ||
|
||
const Wrapper = React.forwardRef<ActionSheetRef>((_, wrapperRef) => { | ||
const [visible, setVisible] = React.useState(false); | ||
|
||
React.useEffect(() => { | ||
setVisible(true); | ||
}, []); | ||
|
||
React.useImperativeHandle(wrapperRef, () => ({ | ||
close: () => { | ||
setVisible(false); | ||
}, | ||
})); | ||
|
||
return ( | ||
<RuntimeConfigProvider> | ||
<ActionSheet | ||
{...props} | ||
visible={visible} | ||
afterClose={() => { | ||
props.afterClose?.(); | ||
unmount(); | ||
}} | ||
mountContainer={false} | ||
/> | ||
</RuntimeConfigProvider> | ||
); | ||
}); | ||
|
||
const ref = React.createRef<ActionSheetRef>(); | ||
unmount = renderToContainer(<Wrapper ref={ref} />, props.mountContainer); | ||
|
||
return { | ||
close: () => { | ||
ref.current?.close(); | ||
}, | ||
}; | ||
return renderImperatively(<ActionSheet {...props} />); | ||
}; |
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
Oops, something went wrong.