@internetarchive/ia-pic-uploader
v0.1.8
Published
A Web Component for Picture upload.
Downloads
123
Maintainers
Keywords
Readme
This is the Profile Pic Uploader Component for Internet Archive website.
Installation
yarn add @internetarchive/ia-pic-uploader
Usage of ia-pic-uploader
import '@internetarchive/ia-pic-uploader';
<div id="demo"></div>
<ia-pic-uploader>
</ia-pic-uploader>
<script type="module">
import { html, render } from 'lit';
import '../dist/src/ia-pic-uploader.js';
render(
html`
<ia-pic-uploader></ia-pic-uploader>
`,
document.querySelector('#demo')
);
const iaPicUploader = document.querySelector('ia-pic-uploader');
iaPicUploader.identifier = 'naturalhistoryof00unse_4111';
iaPicUploader.endpoint = 'https://www-neeraj.archive.org/services/post-file.php';
iaPicUploader.picture = './demo/default-preview.jpg' ;
iaPicUploader.type = 'full'; // full|compact
iaPicUploader.lookingAtMyAccount = true;
iaPicUploader.maxFileSizeInMB = 4; //
iaPicUploader.validFileTypes = ['image/jpeg','image/png','image/gif'];
</script>
Variants
Attribute
- identifier - User identifier.
- endpoint - Endpoint of form submition in case of full variant.
- picture - User profile picture.
- type - Web component type full | compact.
- lookingAtMyAccount - User looking at it's own account
- maxFilesSizeInMB - File's max-size
- validFileTypes - File's valid types
Local Demo with web-dev-server
yarn start
To run a local development server that serves the basic demo located in demo/index.html
Testing with Web Test Runner
To run the suite of Web Test Runner tests, run
yarn run test
To run the tests in watch mode (for <abbr title="test driven development">TDD</abbr>, for example), run
yarn run test:watch
Linting with ESLint, Prettier, and Types
To scan the project for linting errors, run
yarn run lint
You can lint with ESLint and Prettier individually as well
yarn run lint:eslint
yarn run lint:prettier
To automatically fix many linting errors, run
yarn run format
You can format using ESLint and Prettier individually as well
yarn run format:eslint
yarn run format:prettier