1.7.4 • Published 3 years ago

simulador-sulamerica-component v1.7.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

+Built With Stencil

Using Component

To start this component using Stencil, clone this repo to a new directory:

git clone https://github.com/amandacoradini/web-component-simulator-form.git
cd simulador-sulamerica-component
git remote rm origin

and run:

npm install
npm start
yarn install
yarn run start

To build the component for production, run:

npm run build
yarn run build

To run the unit tests for the components, run:

npm test

Script tag

  • Put a script tag similar to this <script src='https://unpkg.com/my-component@0.0.1/dist/my-component.esm.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc

Integration

#Install the component via npm or yarn in your project:

npm install simulador-sulamerica-component
yarn add simulador-sulamerica-component

#Angular

  • Include the CUSTOM_ELEMENTS_SCHEMA in the module. This code should be added into the AppModule and in every other modules that use your custom elements.
import { BrowserModule } from '@angular/platform-browser';
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule, FormsModule],
  bootstrap: [AppComponent],
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
  • The function that is used to load the components of the collection, defineCustomElements(), needs to be called once during your application initialization. In main.ts:
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

import { defineCustomElements } from 'simulador-sulamerica-component/loader';

if (environment.production) {
  enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule)
  .catch(err => console.log(err));
defineCustomElements();

Usage

  • In your component's HTML file:
<div class="content" role="main">
  <sa-simulator color="orange" fontsize="medium" fontcolor="black" background="blue"></sa-simulator>
</div>

Style

  • customizable variables
    • backgroud: string
    • color: string
    • fontcolor: string
    • padding: string
    • imgsize(image height): string
    • fontfamily: string
    • fontsize: "small" "medium" "large"
1.7.5

3 years ago

1.7.4

3 years ago

1.7.3

3 years ago

1.7.2

3 years ago

1.7.1

3 years ago

1.7.0

3 years ago

1.6.0

3 years ago

1.5.0

3 years ago