Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

Commit

Permalink
feat: implement upload package
Browse files Browse the repository at this point in the history
  • Loading branch information
tatinacher committed Jun 16, 2021
1 parent 29ba491 commit c87263c
Show file tree
Hide file tree
Showing 21 changed files with 514 additions and 72 deletions.
36 changes: 15 additions & 21 deletions build/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ const { directory } = require('./library');
const babelConfig = require('./babel');
const { minifyConfig } = require('./minification');

function buildWoly() {
const name = 'woly';

return Promise.all([
const buildPackage = (name) => () =>
Promise.all([
createEsCjs(name, {
dir: directory(`dist/${name}`),
file: {
Expand All @@ -27,24 +25,12 @@ function buildWoly() {
inputExtension: 'ts',
}),
]);
}

function buildCalendar() {
const name = 'calendar';

return Promise.all([
createEsCjs(name, {
dir: directory(`dist/${name}`),
file: {
cjs: `${name}.js`,
// es: `${name}.mjs`,
},
inputExtension: 'ts',
}),
]);
}
const buildWoly = buildPackage('woly');
const buildCalendar = buildPackage('calendar');
const buildUpload = buildPackage('upload');

module.exports = { buildWoly, buildCalendar };
module.exports = { buildWoly, buildCalendar, buildUpload };

const _compatTarget = {
browsers: [
Expand All @@ -56,7 +42,15 @@ const _compatTarget = {
],
};

const externals = ['@woly/calendar', 'react-dom', 'react', 'styled-components', 'woly'];
const externals = [
'@woly/calendar',
'@woly/upload',
'react-dom',
'react',
'styled-components',
'woly',
'react-dropzone',
];

const extensions = ['.js', '.mjs', '.ts', '.tsx'];

Expand Down
12 changes: 11 additions & 1 deletion build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const {
massCopy,
// publishScript,
} = require('./tasks');
const { buildWoly, buildCalendar } = require('./builder');
const { buildWoly, buildCalendar, buildUpload } = require('./builder');

const woly = [
generatePackageJson('woly'),
Expand All @@ -25,6 +25,15 @@ const calendar = [
// publishScript('calendar', '@woly/calendar'),
];

const upload = [
generatePackageJson('upload'),
copyLicense('upload'),
massCopy('packages/upload', 'dist/upload', ['README.md']),
massCopy('packages/upload', 'dist/upload', ['package.json']),
buildUpload,
// publishScript('upload', '@woly/upload'),
];

main();

function main() {
Expand All @@ -45,6 +54,7 @@ function main() {
Promise.all([
run({ tasks: woly, name: 'woly', config }),
run({ tasks: calendar, name: 'calendar', config }),
run({ tasks: upload, name: 'upload', config }),
]);
}

Expand Down
19 changes: 18 additions & 1 deletion build/packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,23 @@ const calendar = {
},
...common,
};

const upload = {
name: '@woly/upload',
version: versions.upload,
description: 'Upload components for Woly React library',
...getModules('upload'),
files: getFiles('upload'),
keywords: [...keywords, 'upload'],
dependencies: {},
peerDependencies: {
...dependsPeer,
...dependsOnWoly,
},
...common,
};

calendar.repository.directory = 'packages/calendar';
upload.repository.directory = 'packages/upload';

module.exports = { woly, calendar };
module.exports = { woly, calendar, upload };
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"@rollup/plugin-url": "^6.0.0",
"@types/node": "^14.14.25",
"@types/react": "^17.0.1",
"@types/react-dropzone": "^5.1.0",
"@types/styled-components": "^5.1.7",
"@types/webpack": "^4.41.26",
"@typescript-eslint/eslint-plugin": "^4.15.0",
Expand Down Expand Up @@ -96,6 +97,7 @@
"dependencies": {
"react": "16.14.0",
"react-dom": "16.14.0",
"react-dropzone": "^11.3.2",
"styled-components": "^5.2.1"
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion packages/calendar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"peerDependencies": {
"react": "^16.11.0",
"styled-components": "^5.0.1",
"woly": "^0.6.0"
"woly": "^0.7.0"
},
"scripts": {},
"author": {
Expand Down
3 changes: 3 additions & 0 deletions packages/upload/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @woly/upload

@woly/upload
1 change: 1 addition & 0 deletions packages/upload/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '../../src/upload';
59 changes: 59 additions & 0 deletions packages/upload/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"name": "@woly/upload",
"description": "Upload components for Woly React library",
"main": "upload.js",
"types": "upload.d.ts",
"typings": "upload.d.ts",
"files": [
"README.md",
"LICENSE",
"upload.js",
"upload.js.map",
"upload.mjs",
"upload.mjs.map",
"upload.d.ts"
],
"keywords": [
"component",
"components",
"design",
"library",
"react-component",
"react",
"system",
"ui",
"woly",
"upload"
],
"dependencies": {},
"peerDependencies": {
"react": "^16.11.0",
"styled-components": "^5.0.1",
"woly": "^0.7.0"
},
"scripts": {},
"author": {
"name": "Sergey Sova",
"email": "mail@sergeysova.com",
"url": "https://sova.dev"
},
"engines": {
"node": ">=8.0.0"
},
"sideEffects": false,
"contributors": [],
"repository": {
"type": "git",
"url": "https://github.com/woly-ui/woly",
"directory": "packages/upload"
},
"homepage": "https://github.com/woly-ui/woly",
"license": "MIT",
"bugs": {
"url": "https://github.com/woly-ui/woly/issues",
"email": "woly@sergeysova.com"
},
"publishConfig": {
"access": "public"
}
}
4 changes: 2 additions & 2 deletions packages/woly/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "woly",
"version": "0.6.0",
"version": "0.7.0",
"description": "Exhaustive component library for React",
"main": "woly.js",
"types": "woly.d.ts",
Expand Down Expand Up @@ -44,7 +44,7 @@
"repository": {
"type": "git",
"url": "https://github.com/woly-ui/woly",
"directory": "packages/calendar"
"directory": "packages/upload"
},
"homepage": "https://github.com/woly-ui/woly",
"license": "MIT",
Expand Down
1 change: 0 additions & 1 deletion src/ui/atoms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ export { Table, Thead, Tbody, Tr, Td, Th } from './table';
export { Text } from './text';
export { TextArea } from './text-area';
export { Tooltip } from './tooltip';
export { UploadArea } from './upload-area';
2 changes: 1 addition & 1 deletion src/ui/molecules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export { Checkbox } from './checkbox';
export { Field } from './field';
export { InputPassword } from './input-password';
export { Modal } from './modal';
export { RadioButton } from './radio-button';
export { Popover } from './popover';
export { RadioButton } from './radio-button';
export { Select } from './select';
export { Switch } from './switch';
1 change: 1 addition & 0 deletions src/upload/atoms/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { UploadArea } from './upload-area';
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,31 @@ import styled, { StyledComponent } from 'styled-components';
import { Variant } from 'lib/types';

interface UploadAreaProps {
className?: string;
center?: boolean;
className?: string;
content?: React.ReactNode;
disabled?: boolean;
focus?: boolean;
}

const UploadAreaBase: React.FC<UploadAreaProps & Variant> = ({
className,
center = false,
className,
content,
focus = false,
variant = 'default',
}) => (
<div className={className} data-variant={variant} tabIndex={0}>
<div className={className} data-variant={variant} data-focus={focus}>
<div data-content data-center={center}>
<div data-overlay />
{content}
</div>
<div data-overlay />
</div>
);

export const UploadArea = styled(UploadAreaBase)`
--local-border-color: var(--woly-canvas-hover);
--local-background-color: var(--woly-canvas-disabled);
position: relative;
width: 100%;
Expand All @@ -44,9 +46,9 @@ export const UploadArea = styled(UploadAreaBase)`
transform: translate(-50%, -50%);
}
&:focus {
&[data-focus='true'] {
--local-border-color: var(--woly-focus);
--local-background-color: rgba(110, 59, 254, 0.05);
outline: none;
[data-overlay] {
Expand Down
Loading

0 comments on commit c87263c

Please sign in to comment.