Skip to content

Commit

Permalink
Merge pull request #82 from AElf-devops/feature/doc-upload
Browse files Browse the repository at this point in the history
feat: add carousel dark
  • Loading branch information
aelf-lxy authored Mar 19, 2024
2 parents b91958d + dcdf5fc commit 4e3ef8a
Show file tree
Hide file tree
Showing 9 changed files with 2,879 additions and 1,819 deletions.
2 changes: 1 addition & 1 deletion packages/component/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aelf-design",
"version": "1.0.0-alpha.10",
"version": "1.0.0-alpha.11",
"type": "module",
"main": "dist/esm/index.js",
"module": "dist/esm/index.js",
Expand Down
15 changes: 15 additions & 0 deletions packages/component/src/Carousel/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,18 @@ group:
| galleryObjectFit | gallery图片展示规则 | `fill \| contain \| cover \| none \| scale-down` | `cover` | `1.0.0` |
| thumbsSlidesPerView | thumbs一页展示多少条 | `number` | `5` | `1.0.0` |
| onSlideClick | 点击轮播图片触发事件,返回值是当前点击的图片ICarouselSlideItem对象 | `(value: ICarouselSlideItem) => void` | - | `1.0.0` |

## Token

```js
<AELFDProvider
customToken={{
customCarousel:{
colorNavigation: isDarkMode ? '#E8E8E8' : '#070A26',
colorNavigationHover: isDarkMode ? '#fff' : '#22253E',
colorNavigationActive: isDarkMode ? '#8C8C8C' : '#131631',
colorMask: isDarkMode ? '#000000cc' : '#ffffffcc',
}
}}
>
```
16 changes: 9 additions & 7 deletions packages/component/src/Carousel/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { SetStateAction, useState } from 'react';
import { NextButtonIcon, PrevButtonIcon } from '@aelf-design/internal-icons';
import { useResponsive } from 'antd-style';
import { useResponsive, useTheme } from 'antd-style';
import { FreeMode, Navigation, Thumbs } from 'swiper/modules';
import { Swiper, SwiperSlide } from 'swiper/react';

Expand Down Expand Up @@ -43,6 +43,8 @@ export default function Carousel(props: ICarouselProps) {
galleryObjectFit: galleryObjectFit || 'cover',
});
const responsive = useResponsive();

const token = useTheme();
return (
<div className={cx(st.Carousel, prefixCls + 'carousel', className)}>
<Swiper
Expand Down Expand Up @@ -77,19 +79,19 @@ export default function Carousel(props: ICarouselProps) {
<div className="swiper-button-next">
<NextButtonIcon
className="navigation-button"
color="#070A26"
hoverColor="#22253E"
activeColor="#131631"
color={token.customCarousel?.colorNavigation}
hoverColor={token.customCarousel?.colorNavigationHover}
activeColor={token.customCarousel?.colorNavigationActive}
width={16}
height={60}
/>
</div>
<div className="swiper-button-prev">
<PrevButtonIcon
className="navigation-button"
color="#070A26"
hoverColor="#22253E"
activeColor="#131631"
color={token.customCarousel?.colorNavigation}
hoverColor={token.customCarousel?.colorNavigationHover}
activeColor={token.customCarousel?.colorNavigationActive}
width={16}
height={60}
/>
Expand Down
4 changes: 2 additions & 2 deletions packages/component/src/Carousel/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createStyles } from 'antd-style';

const useStyles = createStyles(
(
{ responsive, css },
{ responsive, css, token },
props: {
thumbsSwiperWidth: number;
galleryObjectFit: string;
Expand Down Expand Up @@ -75,7 +75,7 @@ const useStyles = createStyles(
position: absolute;
cursor: pointer;
inset: 0;
background-color: #ffffffcc;
background-color: ${token.customCarousel?.colorMask};
}
}
.mobile-thumbs-slide {
Expand Down
4 changes: 2 additions & 2 deletions packages/component/src/RichProgress/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ const StepItemIcon = ({
const responsive = useResponsive();
const { styles, cx } = useStyles();
if (status === 'exception') {
return errorIcon || <ProgressErrorIcon className={cx(styles.errorIcon)} />;
return <>{errorIcon}</> || <ProgressErrorIcon className={cx(styles.errorIcon)} />;
}
if (percent === 100) {
return successIcon || <ProgressSuccessIcon className={cx(styles.successIcon)} />;
return <>{successIcon}</> || <ProgressSuccessIcon className={cx(styles.successIcon)} />;
}
return (
<Progress
Expand Down
10 changes: 8 additions & 2 deletions packages/component/src/Table/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ group:
1. customize pagination
2. customize table header

:::warning由于重写了分页器,这个onChange不会触发分页.使用分页组件的onChange :::
<!-- prettier-ignore -->
:::warning
由于重写了分页器,这个onChange不会触发分页.使用分页组件的onChange
:::

## Basic Table

Expand Down Expand Up @@ -48,7 +51,10 @@ refer to[Table Token](https://ant.design/components/table-cn#%E4%B8%BB%E9%A2%98%

## API

:::warning由于重写了分页器,这个onChange不会触发分页.使用分页组件的onChange :::
<!-- prettier-ignore -->
:::warning
由于重写了分页器,这个onChange不会触发分页.使用分页组件的onChange
:::

| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
Expand Down
5 changes: 3 additions & 2 deletions packages/component/src/Upload/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function UploadItemRender({
const { styles, cx } = useStyles();
const token = useTheme();
return file.url || file.thumbUrl ? (
file.status === 'done' && (
(file.status === 'done' && (
<div className={cx(styles.previewContainer)}>
<Image
height={202}
Expand All @@ -53,7 +53,8 @@ function UploadItemRender({
</div>
</div>
</div>
)
)) ||
null
) : (
<div className={cx(styles.FilePreviewContainer)}>
<div className="file-icon-container">
Expand Down
15 changes: 14 additions & 1 deletion packages/component/src/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ export interface IAelfdCustomToken {
customRadio?: {
dotColor?: string;
};
customCarousel?: {
colorNavigation?: string;
colorNavigationHover?: string;
colorNavigationActive?: string;
colorMask?: string;
};
}

declare module 'antd-style' {
Expand Down Expand Up @@ -102,9 +108,16 @@ const AELFDProvider = (props: IAelfdThemeProviderProps) => {
...props.customToken?.customRichProgress,
},
customRadio: {
dotColor: isDarkMode ? '#1A1A1A' : '#FFFFFF',
dotColor: isDarkMode ? '#d07171' : '#FFFFFF',
...props.customToken?.customRadio,
},
customCarousel: {
colorNavigation: isDarkMode ? '#E8E8E8' : '#070A26',
colorNavigationHover: isDarkMode ? '#fff' : '#22253E',
colorNavigationActive: isDarkMode ? '#8C8C8C' : '#131631',
colorMask: isDarkMode ? '#000000cc' : '#ffffffcc',
...props.customToken?.customCarousel,
},
};
}}
theme={(appearance: ThemeAppearance) => {
Expand Down
Loading

0 comments on commit 4e3ef8a

Please sign in to comment.