Skip to content

Commit

Permalink
feat(backtop): rtl (jdf2e#2051)
Browse files Browse the repository at this point in the history
Co-authored-by: xiaoyatong <[email protected]>
  • Loading branch information
xiaoyatong and xiaoyatong authored Mar 18, 2024
1 parent 4a6fe09 commit aa3b385
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/packages/backtop/backtop.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { usePageScroll, pageScrollTo } from '@tarojs/taro'
import { Top } from '@nutui/icons-react-taro'
import classNames from 'classnames'
import { BasicComponent, ComponentDefaults } from '@/utils/typings'
import { useRtl } from '@/packages/configprovider/index.taro'

export interface BackTopProps extends BasicComponent {
threshold: number
Expand All @@ -22,6 +23,7 @@ const defaultProps = {
export const BackTop: FunctionComponent<
Partial<BackTopProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'>
> = (props) => {
const rtl = useRtl()
const { children, threshold, zIndex, className, duration, style, onClick } = {
...defaultProps,
...props,
Expand Down Expand Up @@ -53,7 +55,7 @@ export const BackTop: FunctionComponent<
...style,
}
: {
right: '10px',
[rtl ? 'left' : 'right']: '10px',
bottom: '20px',
zIndex,
}
Expand Down
4 changes: 3 additions & 1 deletion src/packages/backtop/backtop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Top } from '@nutui/icons-react'
import classNames from 'classnames'
import { BasicComponent, ComponentDefaults } from '@/utils/typings'
import requestAniFrame from '@/utils/raf'
import { useRtl } from '@/packages/configprovider'

declare const window: any

Expand All @@ -26,6 +27,7 @@ const defaultProps = {
export const BackTop: FunctionComponent<
Partial<BackTopProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'>
> = (props) => {
const rtl = useRtl()
const {
children,
target,
Expand Down Expand Up @@ -121,7 +123,7 @@ export const BackTop: FunctionComponent<
...style,
}
: {
right: '10px',
[rtl ? 'left' : 'right']: '10px',
bottom: '20px',
zIndex,
}
Expand Down
2 changes: 0 additions & 2 deletions src/packages/badge/badge.taro.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import React, { CSSProperties, FunctionComponent, ReactNode } from 'react'
import classNames from 'classnames'

import { BasicComponent, ComponentDefaults } from '@/utils/typings'
import { useRtl } from '@/packages/configprovider/index.taro'

export type BadgeFill = 'solid' | 'outline'

export interface BadgeProps extends BasicComponent {
value: ReactNode
dot: boolean
Expand Down
1 change: 0 additions & 1 deletion src/packages/badge/badge.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { CSSProperties, FunctionComponent, ReactNode } from 'react'
import classNames from 'classnames'

import { BasicComponent, ComponentDefaults } from '@/utils/typings'
import { useRtl } from '@/packages/configprovider'

Expand Down

0 comments on commit aa3b385

Please sign in to comment.