Skip to content

Commit

Permalink
revert(react): ⏪ use taroify
Browse files Browse the repository at this point in the history
  • Loading branch information
anyesu committed Feb 20, 2024
1 parent 67d6725 commit 0652ab7
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 191 deletions.
1 change: 0 additions & 1 deletion packages/taro-demo-react/.prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const order = [
//
'^@tarojs/',
'react',
'^@taroify/',
];

importOrder.splice(1, 0, ...order);
Expand Down
21 changes: 0 additions & 21 deletions packages/taro-demo-react/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,4 @@ module.exports = {
},
],
],
plugins: [
[
'import',
{
libraryName: '@taroify/core',
libraryDirectory: '',
style: true,
},
'@taroify/core',
],
[
'import',
{
libraryName: '@taroify/icons',
libraryDirectory: '',
camel2DashComponentName: false,
style: () => '@taroify/icons/style',
},
'@taroify/icons',
],
],
};
10 changes: 1 addition & 9 deletions packages/taro-demo-react/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,7 @@ export default defineConfig(async (merge) => {
options: {},
},
framework: 'react',
compiler: {
type: 'webpack5',
// 仅 webpack5 支持依赖预编译配置
prebundle: {
// PreBundle 与 @taroify/icons 不兼容: `No matching export in ...` `import { createVanIconComponent } from "./van"`
exclude: ['@taroify/icons'],
},
},
compiler: 'webpack5',
cache: {
enable: false, // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
},
Expand Down Expand Up @@ -70,7 +63,6 @@ export default defineConfig(async (merge) => {
filename: 'css/[name].[hash].css',
chunkFilename: 'css/[name].[chunkhash].css',
},
esnextModules: ['@taroify'],
postcss: {
autoprefixer: {
enable: true,
Expand Down
3 changes: 0 additions & 3 deletions packages/taro-demo-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
],
"dependencies": {
"@babel/runtime": "7.24.4",
"@taroify/core": "0.1.6-alpha.0",
"@taroify/icons": "0.1.6-alpha.0",
"@tarojs/components": "3.6.25",
"@tarojs/helper": "3.6.25",
"@tarojs/plugin-framework-react": "3.6.25",
Expand Down Expand Up @@ -66,7 +64,6 @@
"@types/jest": "29.5.12",
"@types/react": "18.2.74",
"@types/webpack-env": "1.18.4",
"babel-plugin-import": "1.13.8",
"babel-preset-taro": "3.6.25",
"eslint-config-taro": "3.6.25",
"eslint-plugin-import": "2.12.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/taro-demo-react/src/components/BizPage.module.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import '~@taroify/core/styles/variables';
// Base Unit
$hd: 2;

.page {
height: 100vh;
Expand Down
8 changes: 0 additions & 8 deletions packages/taro-demo-react/src/components/BizPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { View } from '@tarojs/components';
import Taro from '@tarojs/taro';
import type { PropsWithChildren } from 'react';
import { ArrowLeft } from '@taroify/icons';
import classNames from 'classnames';
import { TargetH5 } from './Target';
import styles from './BizPage.module.scss';
Expand All @@ -10,19 +8,13 @@ interface PageProps {
className?: string;
title?: string;
}

async function onClickBack() {
await Taro.navigateBack();
}

export default function BizPage(props: PropsWithChildren<PageProps>) {
const { className, title, children } = props;

return (
<View className={classNames(styles.page, className)}>
<TargetH5>
<View className={styles.page__nav}>
<ArrowLeft className={styles.page__nav__back} onClick={onClickBack} />
<View className={styles.page__nav__title}>{title}</View>
</View>
</TargetH5>
Expand Down
39 changes: 0 additions & 39 deletions packages/taro-demo-react/src/pages/index/index.module.scss

This file was deleted.

37 changes: 8 additions & 29 deletions packages/taro-demo-react/src/pages/index/index.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,14 @@
import { Image, Text, View } from '@tarojs/components';
import { navs, type NavConfig } from './constants';
import Nav, { NavBlock } from './nav';
import styles from './index.module.scss';
import { Text, View } from '@tarojs/components';
import { useLoad } from '@tarojs/taro';

function renderNavBlocks(group: string, children: NavConfig[]) {
return children.map(({ name, path }) => (
<NavBlock key={path} href={`/pages/${group}/${path}`} title={name} />
));
}

function renderNavs() {
return navs.map(({ name, path, children }) => (
<Nav key={path} title={name}>
{renderNavBlocks(path, children)}
</Nav>
));
}
export default function Index() {
useLoad(() => {
console.log('Page loaded.');
});

export default function Home() {
return (
<View className={styles.home}>
<View className={styles.home__title}>
<Image
className={styles.home__logo}
mode="aspectFit"
src="https://img01.yzcdn.cn/vant/logo.png"
/>
<Text className={styles.home__name}>Taroify</Text>
</View>
<View className={styles.home__description}>轻量、可靠的小程序端 Taro 组件库</View>
{renderNavs()}
<View className="index">
<Text>Hello world!</Text>
</View>
);
}
46 changes: 0 additions & 46 deletions packages/taro-demo-react/src/pages/index/nav.module.scss

This file was deleted.

34 changes: 0 additions & 34 deletions packages/taro-demo-react/src/pages/index/nav.tsx

This file was deleted.

0 comments on commit 0652ab7

Please sign in to comment.