Best JavaScript code snippet using storybook-root
configuration.component.ts
Source:configuration.component.ts
1import {Component, NgZone, OnInit, ViewEncapsulation} from '@angular/core';2import {NextConfig} from '../../../../app-config';3import {Location} from '@angular/common';4import { Usuario } from 'src/app/estructuras/usuario';5@Component({6 selector: 'app-configuration',7 templateUrl: './configuration.component.html',8 styleUrls: ['./configuration.component.scss'],9 encapsulation: ViewEncapsulation.None10})11export class ConfigurationComponent implements OnInit {12 public styleSelectorToggle: boolean; // open configuration menu13 public layoutType: string; // layout type14 public rtlLayout: any; // rtl type15 public menuFixedLayout: any; // menu/navbar fixed flag16 public headerFixedLayout: any; // header fixed flag17 public boxLayout: any; // box layout flag18 public headerBackgroundColor: string; // header background color19 public headerBackColor: string;20 public nextConfig: any;21 public isConfig: boolean;22 scroll = (): void => {23 if (this.headerFixedLayout === false) {24 (document.querySelector('#nav-ps-next') as HTMLElement).style.maxHeight = 'calc(100vh)';25 const el = document.querySelector('.pcoded-navbar.menupos-fixed') as HTMLElement;26 const scrollPosition = window.pageYOffset;27 if (scrollPosition > 60) {28 el.style.position = 'fixed';29 el.style.transition = 'none';30 el.style.marginTop = '0';31 } else {32 el.style.position = 'absolute';33 el.style.marginTop = '60px';34 }35 } else if (document.querySelector('.pcoded-navbar').hasAttribute('style')) {36 document.querySelector('.pcoded-navbar.menupos-fixed').removeAttribute('style');37 }38 }39 constructor(private zone: NgZone, private location: Location) {40 this.nextConfig = NextConfig.config;41 this.setThemeLayout();42 }43 ngOnInit() {44 this.styleSelectorToggle = false;45 this.layoutType = this.nextConfig.layoutType;46 this.setLayout(this.layoutType);47 this.headerBackgroundColor = this.nextConfig.headerBackColor;48 this.setHeaderBackground(this.headerBackgroundColor);49 this.rtlLayout = this.nextConfig.rtlLayout;50 this.changeRtlLayout(this.rtlLayout);51 this.menuFixedLayout = this.nextConfig.navFixedLayout;52 if (this.nextConfig.layout === 'vertical') {53 this.changeMenuFixedLayout(this.menuFixedLayout);54 }55 this.headerFixedLayout = this.nextConfig.headerFixedLayout;56 this.changeHeaderFixedLayout(this.headerFixedLayout);57 this.boxLayout = this.nextConfig.boxLayout;58 this.changeBoxLayout(this.boxLayout);59 }60 setThemeLayout() {61 let currentURL = this.location.path();62 const baseHref = this.location['_baseHref'];63 if (baseHref) {64 currentURL = baseHref + this.location.path();65 }66 switch (currentURL) {67 case baseHref + '/layout/static':68 this.nextConfig.layout = 'vertical';69 this.nextConfig.navFixedLayout = false;70 this.nextConfig.headerFixedLayout = false;71 break;72 case baseHref + '/layout/fixed':73 this.nextConfig.layout = 'vertical';74 this.nextConfig.navFixedLayout = true;75 this.nextConfig.headerFixedLayout = true;76 break;77 case baseHref + '/layout/nav-fixed':78 this.nextConfig.layout = 'vertical';79 this.nextConfig.navFixedLayout = true;80 this.nextConfig.headerFixedLayout = false;81 break;82 case baseHref + '/layout/collapse-menu':83 this.nextConfig.layout = 'vertical';84 this.nextConfig.collapseMenu = true;85 break;86 case baseHref + '/layout/vertical-rtl':87 this.nextConfig.layout = 'vertical';88 this.nextConfig.rtlLayout = true;89 break;90 case baseHref + '/layout/horizontal':91 this.nextConfig.layout = 'horizontal';92 this.nextConfig.navFixedLayout = false;93 this.nextConfig.headerFixedLayout = false;94 this.nextConfig.collapseMenu = false;95 break;96 case baseHref + '/layout/horizontal-l2':97 this.nextConfig.layout = 'horizontal';98 this.nextConfig.subLayout = 'horizontal-2';99 this.nextConfig.navFixedLayout = false;100 this.nextConfig.headerFixedLayout = false;101 this.nextConfig.collapseMenu = false;102 break;103 case baseHref + '/layout/horizontal-rtl':104 this.nextConfig.layout = 'horizontal';105 this.nextConfig.subLayout = 'horizontal-2';106 this.nextConfig.navFixedLayout = false;107 this.nextConfig.headerFixedLayout = false;108 this.nextConfig.rtlLayout = true;109 this.nextConfig.collapseMenu = false;110 break;111 case baseHref + '/layout/box':112 this.nextConfig.layout = 'vertical';113 this.nextConfig.boxLayout = true;114 this.nextConfig.navFixedLayout = true;115 this.nextConfig.headerFixedLayout = false;116 this.nextConfig.collapseMenu = true;117 break;118 case baseHref + '/layout/light':119 this.nextConfig.layout = 'vertical';120 this.nextConfig.layoutType = 'menu-light';121 this.nextConfig.headerBackColor = 'background-blue';122 break;123 case baseHref + '/layout/dark':124 this.nextConfig.layout = 'vertical';125 this.nextConfig.layoutType = 'dark';126 this.nextConfig.headerBackColor = 'background-blue';127 break;128 default:129 break;130 }131 }132 setHeaderBackColor(color) {133 this.headerBackColor = color;134 (document.querySelector('body') as HTMLElement).style.background = color;135 }136 // change main layout137 setLayout(layout) {138 this.isConfig = true;139 document.querySelector('.pcoded-navbar').classList.remove('menu-light');140 document.querySelector('.pcoded-navbar').classList.remove('menu-dark');141 document.querySelector('body').classList.remove('able-pro-dark');142 this.layoutType = layout;143 if (layout === 'menu-light') {144 document.querySelector('.pcoded-navbar').classList.add(layout);145 this.setHeaderBackground('background-blue');146 }147 if (layout === 'dark') {148 this.setHeaderBackground('background-blue');149 document.querySelector('body').classList.add('able-pro-dark');150 }151 if (layout === 'reset') {152 this.reset();153 }154 }155 reset() {156 this.ngOnInit();157 }158 setRtlLayout(e) {159 const flag = !!(e.target.checked);160 this.changeRtlLayout(flag);161 }162 changeRtlLayout(flag) {163 if (flag) {164 document.querySelector('body').classList.add('able-pro-rtl');165 } else {166 document.querySelector('body').classList.remove('able-pro-rtl');167 }168 }169 setMenuFixedLayout(e) {170 const flag = !!(e.target.checked);171 this.changeMenuFixedLayout(flag);172 }173 changeMenuFixedLayout(flag) {174 setTimeout(() => {175 if (flag) {176 document.querySelector('.pcoded-navbar').classList.remove('menupos-static');177 document.querySelector('.pcoded-navbar').classList.add('menupos-fixed');178 if (this.nextConfig.layout === 'vertical') {179 (document.querySelector('#nav-ps-next') as HTMLElement).style.maxHeight = 'calc(100vh - 60px)'; // calc(100vh - 70px) amit180 }181 window.addEventListener('scroll', this.scroll, true);182 window.scrollTo(0, 0);183 } else {184 document.querySelector('.pcoded-navbar').classList.add('menupos-static');185 document.querySelector('.pcoded-navbar').classList.remove('menupos-fixed');186 if (this.nextConfig.layout === 'vertical') {187 (document.querySelector('#nav-ps-next') as HTMLElement).style.maxHeight = 'calc(100%)'; // calc(100% - 70px) amit188 }189 if (this.nextConfig.layout === 'vertical') {190 window.removeEventListener('scroll', this.scroll, true);191 }192 }193 }, 100);194 }195 setHeaderFixedLayout(e) {196 const flag = !!(e.target.checked);197 this.changeHeaderFixedLayout(flag);198 }199 changeHeaderFixedLayout(flag) {200 if (flag) {201 document.querySelector('.pcoded-header').classList.add('headerpos-fixed');202 } else {203 document.querySelector('.pcoded-header').classList.remove('headerpos-fixed');204 // static205 if (this.nextConfig.layout === 'vertical' && this.menuFixedLayout) {206 window.addEventListener('scroll', this.scroll, true);207 window.scrollTo(0, 0);208 } else {209 window.removeEventListener('scroll', this.scroll, true);210 }211 }212 }213 setBoxLayout(e) {214 const flag = !!(e.target.checked);215 this.changeBoxLayout(flag);216 }217 changeBoxLayout(flag) {218 if (flag) {219 document.querySelector('body').classList.add('container');220 document.querySelector('body').classList.add('box-layout');221 } else {222 document.querySelector('body').classList.remove('box-layout');223 document.querySelector('body').classList.remove('container');224 }225 }226 setHeaderBackground(background) {227 this.headerBackgroundColor = background;228 document.querySelector('body').classList.remove('background-blue');229 document.querySelector('body').classList.remove('background-red');230 document.querySelector('body').classList.remove('background-purple');231 document.querySelector('body').classList.remove('background-info');232 document.querySelector('body').classList.remove('background-green');233 document.querySelector('body').classList.remove('background-dark');234 document.querySelector('body').classList.remove('background-grd-blue');235 document.querySelector('body').classList.remove('background-grd-red');236 document.querySelector('body').classList.remove('background-grd-purple');237 document.querySelector('body').classList.remove('background-grd-info');238 document.querySelector('body').classList.remove('background-grd-green');239 document.querySelector('body').classList.remove('background-grd-dark');240 document.querySelector('body').classList.remove('background-img-1');241 document.querySelector('body').classList.remove('background-img-2');242 document.querySelector('body').classList.remove('background-img-3');243 document.querySelector('body').classList.remove('background-img-4');244 document.querySelector('body').classList.remove('background-img-5');245 document.querySelector('body').classList.remove('background-img-6');246 this.validarPerfil();247 }248 validarPerfil(){249 let usuario = Usuario.getUser();250 if(usuario.emprendedor == 1){251 this.headerBackgroundColor = 'background-img-6';252 document.querySelector('body').classList.add('background-img-6');253 }254 if(usuario.asistencia_tecnica == 1){255 this.headerBackgroundColor = 'background-grd-dark';256 document.querySelector('body').classList.add('background-img-6');257 document.querySelector('.pcoded-navbar').classList.remove("menu-light");258 }259 if(usuario.mentor == 1) {260 this.headerBackgroundColor = 'background-grd-dark';261 document.querySelector('body').classList.add('background-img-6');262 document.querySelector('.pcoded-navbar').classList.remove("menu-light");263 }264 if(usuario.administrador == 1) {265 this.headerBackgroundColor = 'background-grd-dark';266 document.querySelector('body').classList.add('background-grd-dark');267 document.querySelector('.pcoded-navbar').classList.remove("menu-light");268 }269 if(usuario.mesa_servicio == 1) {270 this.headerBackgroundColor = 'background-grd-dark';271 document.querySelector('body').classList.add('background-grd-dark');272 document.querySelector('.pcoded-navbar').classList.remove("menu-light");273 }274 }...
commerce.service.ts
Source:commerce.service.ts
1import { Injectable } from '@angular/core';2import { HttpClient, HttpHeaders } from '@angular/common/http';3import { NextConfig } from '../config';4import { map } from 'rxjs';5import { UrlResponse } from '../models/UrlResponse';6import { OAuth } from '../models/Auth';7import { Parameter, TarifaDelivery, Company, CompanyInscription, Store, UserCompany } from '../models/Company';8@Injectable({9 providedIn: 'root'10})11export class CommerceService {12 constructor(13 private http: HttpClient,14 ) { }15 gettypedocument(seccion: OAuth) {16 const headers = new HttpHeaders({17 'Content-Type': 'application/json',18 'Authorization': seccion.token_type + ' ' + seccion.access_token19 });20 return this.http.get(21 NextConfig.config.url + NextConfig.config.versionapi + '/ui/typedocument',22 {headers},23 ).pipe(24 map(res => res as UrlResponse<Parameter> )25 );26 }27 gettypepaymentaccepted(seccion: OAuth) {28 const headers = new HttpHeaders({29 'Content-Type': 'application/json',30 'Authorization': seccion.token_type + ' ' + seccion.access_token31 });32 return this.http.get(33 NextConfig.config.url + NextConfig.config.versionapi + '/ui/typepaymentaccepted',34 {headers},35 ).pipe(36 map(res => res as UrlResponse<Parameter> )37 );38 }39 gettag(seccion: OAuth) {40 const headers = new HttpHeaders({41 'Content-Type': 'application/json',42 'Authorization': seccion.token_type + ' ' + seccion.access_token43 });44 return this.http.get(45 NextConfig.config.url + NextConfig.config.versionapi + '/ui/tag',46 {headers},47 ).pipe(48 map(res => res as UrlResponse<Parameter> )49 );50 }51 saveTag(seccion: OAuth, data: string) {52 const headers = new HttpHeaders({53 'Content-Type': 'application/json',54 'Authorization': seccion.token_type + ' ' + seccion.access_token55 });56 return this.http.post(57 NextConfig.config.url + NextConfig.config.versionapi + '/ui/tag',58 data,59 {headers},60 ).pipe(61 map(res => res as UrlResponse<Parameter> )62 );63 }64 getCompany(seccion: OAuth) {65 const headers = new HttpHeaders({66 'Content-Type': 'application/json',67 'Authorization': seccion.token_type + ' ' + seccion.access_token68 });69 return this.http.get(70 NextConfig.config.url + NextConfig.config.versionapi + '/commerce/company',71 {headers},72 ).pipe(73 map(res => res as UrlResponse<Company> )74 );75 }76 postCompany(seccion: OAuth, data: any) {77 const headers = new HttpHeaders({78 'Content-Type': 'application/json',79 'Authorization': seccion.token_type + ' ' + seccion.access_token80 });81 return this.http.put(82 NextConfig.config.url + NextConfig.config.versionapi + '/commerce/company',83 data,84 {headers},85 ).pipe(86 map(res => res as UrlResponse<Company> )87 );88 }89 getCompanyInscriptcion(seccion: OAuth) {90 const headers = new HttpHeaders({91 'Content-Type': 'application/json',92 'Authorization': seccion.token_type + ' ' + seccion.access_token93 });94 return this.http.get(95 NextConfig.config.url + NextConfig.config.versionapi + '/commerce/inscription',96 {headers},97 ).pipe(98 map(res => res as UrlResponse<CompanyInscription> )99 );100 }101 getStores(seccion: OAuth) {102 const headers = new HttpHeaders({103 'Content-Type': 'application/json',104 'Authorization': seccion.token_type + ' ' + seccion.access_token105 });106 return this.http.get(107 NextConfig.config.url + NextConfig.config.versionapi + '/stores',108 {headers},109 ).pipe(110 map(res => res as UrlResponse<Store[]> )111 );112 }113 putStores(seccion: OAuth, data: any) {114 const headers = new HttpHeaders({115 'Content-Type': 'application/json',116 'Authorization': seccion.token_type + ' ' + seccion.access_token117 });118 return this.http.put(119 NextConfig.config.url + NextConfig.config.versionapi + '/stores',120 data,121 {headers},122 ).pipe(123 map(res => res as UrlResponse<Store[]> )124 );125 }126 postStores(seccion: OAuth, data: any) {127 const headers = new HttpHeaders({128 'Content-Type': 'application/json',129 'Authorization': seccion.token_type + ' ' + seccion.access_token130 });131 return this.http.post(132 NextConfig.config.url + NextConfig.config.versionapi + '/stores',133 data,134 {headers},135 ).pipe(136 map(res => res as UrlResponse<Store[]> )137 );138 }139 putStoresHours(seccion: OAuth, data: any) {140 const headers = new HttpHeaders({141 'Content-Type': 'application/json',142 'Authorization': seccion.token_type + ' ' + seccion.access_token143 });144 return this.http.put(145 NextConfig.config.url + NextConfig.config.versionapi + '/stores/hours',146 data,147 {headers},148 ).pipe(149 map(res => res as UrlResponse<Store[]> )150 );151 }152 getTarifaDelivery(seccion: OAuth) {153 const headers = new HttpHeaders({154 'Content-Type': 'application/json',155 'Authorization': seccion.token_type + ' ' + seccion.access_token156 });157 return this.http.get(158 NextConfig.config.url + NextConfig.config.versionapi + '/commerce/deliveryrate',159 {headers},160 ).pipe(161 map(res => res as UrlResponse<TarifaDelivery> )162 );163 }164 postTarifaDelivery(seccion: OAuth, data: any) {165 const headers = new HttpHeaders({166 'Content-Type': 'application/json',167 'Authorization': seccion.token_type + ' ' + seccion.access_token168 });169 return this.http.put(170 NextConfig.config.url + NextConfig.config.versionapi + '/commerce/deliveryrate',171 data,172 {headers},173 ).pipe(174 map(res => res as UrlResponse<TarifaDelivery> )175 );176 }177 getCompanytag(seccion: OAuth) {178 const headers = new HttpHeaders({179 'Content-Type': 'application/json',180 'Authorization': seccion.token_type + ' ' + seccion.access_token181 });182 return this.http.get(183 NextConfig.config.url + NextConfig.config.versionapi + '/commerce/tag',184 {headers},185 ).pipe(186 map(res => res as UrlResponse<any> )187 );188 }189 validatorRuc(seccion: OAuth, data: any){190 const headers = new HttpHeaders({191 'Content-Type': 'application/json',192 'Authorization': seccion.token_type + ' ' + seccion.access_token193 });194 return this.http.put(195 NextConfig.config.url + NextConfig.config.versionapi + '/validator/ruc',196 data,197 {headers},198 ).pipe(199 map(res => res as UrlResponse<TarifaDelivery> )200 );201 }202 getGeoCities(seccion: OAuth) {203 const headers = new HttpHeaders({204 'Content-Type': 'application/json',205 'Authorization': seccion.token_type + ' ' + seccion.access_token206 });207 return this.http.get(208 NextConfig.config.url + NextConfig.config.versionapi + '/ui/cities',209 {headers},210 ).pipe(211 map(res => res as UrlResponse<any> )212 );213 }214 getGeoProvince(seccion: OAuth, id:string) {215 const headers = new HttpHeaders({216 'Content-Type': 'application/json',217 'Authorization': seccion.token_type + ' ' + seccion.access_token218 });219 return this.http.get(220 NextConfig.config.url + NextConfig.config.versionapi + '/ui/provinces/'+id,221 {headers},222 ).pipe(223 map(res => res as UrlResponse<any> )224 );225 }226 getGeoDistrict(seccion: OAuth, id:string) {227 const headers = new HttpHeaders({228 'Content-Type': 'application/json',229 'Authorization': seccion.token_type + ' ' + seccion.access_token230 });231 return this.http.get(232 NextConfig.config.url + NextConfig.config.versionapi + '/ui/districts/'+id,233 {headers},234 ).pipe(235 map(res => res as UrlResponse<any> )236 );237 }238 getUsersCompany(seccion: OAuth) {239 const headers = new HttpHeaders({240 'Content-Type': 'application/json',241 'Authorization': seccion.token_type + ' ' + seccion.access_token242 });243 return this.http.get(244 NextConfig.config.url + NextConfig.config.versionapi + '/company/users',245 {headers},246 ).pipe(247 map(res => res as UrlResponse<UserCompany[]> )248 );249 }250 postUsersCompany(seccion: OAuth, data: any) {251 const headers = new HttpHeaders({252 'Content-Type': 'application/json',253 'Authorization': seccion.token_type + ' ' + seccion.access_token254 });255 return this.http.post(256 NextConfig.config.url + NextConfig.config.versionapi + '/changepassword',257 data,258 {headers},259 ).pipe(260 map(res => res as UrlResponse<any> )261 );262 }263 postAssignStore(seccion: OAuth, data: any) {264 const headers = new HttpHeaders({265 'Content-Type': 'application/json',266 'Authorization': seccion.token_type + ' ' + seccion.access_token267 });268 return this.http.post(269 NextConfig.config.url + NextConfig.config.versionapi + '/stores/assign',270 data,271 {headers},272 ).pipe(273 map(res => res as UrlResponse<any> )274 );275 }276 uploadImg(seccion: OAuth, data: any) {277 const headers = new HttpHeaders({278 'Content-Type': 'application/json',279 'Authorization': seccion.token_type + ' ' + seccion.access_token280 });281 return this.http.post(282 NextConfig.config.url + NextConfig.config.versionapi + '/ui/upload',283 data,284 {headers},285 ).pipe(286 map(res => res as UrlResponse<any> )287 );288 }289 checkRuc(ruc: number) {290 const headers = new HttpHeaders({291 'Content-Type': 'application/json',292 });293 return this.http.get(294 NextConfig.config.url + NextConfig.config.versionapi + '/validator/ruc/' + ruc,295 {headers}296 ).pipe(297 map(res => res as UrlResponse<any> )298 );299 }300 getCoverage(seccion: OAuth, id: string) {301 const headers = new HttpHeaders({302 'Content-Type': 'application/json',303 'Authorization': seccion.token_type + ' ' + seccion.access_token304 });305 return this.http.get(306 NextConfig.config.url + NextConfig.config.versionapi + '/stores/coverage/' + id,307 {headers},308 ).pipe(309 map(res => res as UrlResponse<Company> )310 );311 }312 getClientsByCompany(seccion: OAuth, company_id: string) {313 const headers = new HttpHeaders({314 'Content-Type': 'application/json',315 'Authorization': seccion.token_type + ' ' + seccion.access_token316 });317 return this.http.get(318 NextConfig.config.url + NextConfig.config.versionapi + '/clients/company/' + company_id,319 {headers},320 ).pipe(321 map(res => res as UrlResponse<Company> )322 );323 }...
Using AI Code Generation
1const path = require('path');2module.exports = {3 stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],4 webpackFinal: (config) => {5 const nextConfig = require('../next.config.js');6 const nextConfigModule = nextConfig();7 const { webpack } = nextConfigModule;8 config.resolve.alias = {9 ...webpack(config).resolve.alias,10 };11 path.resolve(__dirname, '../src'),12 ];13 return config;14 },15};16const withPlugins = require('next-compose-plugins');17const withBundleAnalyzer = require('@next/bundle-analyzer')({18});19const withImages = require('next-images');20const withFonts = require('next-fonts');21const withVideos = require('next-videos');22const withCSS = require('@zeit/next-css');23const withSass = require('@zeit/next-sass');24const withLess = require('@zeit/next-less');25const withMDX = require('@next/mdx')({26});27const withTM = require('next-transpile-modules')([28]);29const nextConfig = {30 webpack: (config) => {31 config.module.rules.push({32 test: /\.(png|svg|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)(\?.*)?$/,33 {34 options: {35 },36 },37 });38 return config;39 },40 exportPathMap: function () {41 return {42 '/': { page: '/' },43 };44 },45};
Using AI Code Generation
1module.exports = {2 webpackFinal: async (config, { configType }) => {3 config.module.rules.push({4 {5 },6 {7 },8 {9 options: {10 },11 },12 include: path.resolve(__dirname, '../'),13 });14 return config;15 },16};17import { addParameters, addDecorator } from '@storybook/react';18import { withA11y } from '@storybook/addon-a11y';19import { withKnobs } from '@storybook/addon-knobs';20import { withInfo } from '@storybook/addon-info';21import { withNotes } from '@storybook/addon-notes';22import { withOptions } from '@storybook/addon-options';23import { withViewport } from '@storybook/addon-viewport';24import { withTests } from '@storybook/addon-jest';25import { withBackgrounds } from '@storybook/addon-backgrounds';26import { withStorySource } from '@storybook/addon-storysource';27import { withContexts } from '@storybook/addon-contexts/react';28import { withNextRouter } from 'storybook-addon-next-router';29import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';30import { ThemeProvider } from 'styled-components';31import { withThemesProvider } from 'storybook-addon-styled-component-theme';32import { withConsole } from '@storybook/addon-console';33import { withPerformance } from 'storybook-addon-performance';34import { addReadme } from 'storybook-readme/vue';35import { withCode } from 'storybook-addon-code';36import { withGraphQL } from 'storybook-addon-graphql';37import { withCssResources } from '@storybook/addon-cssresources';38import { withPaddings } from 'storybook
Using AI Code Generation
1module.exports = {2 webpackFinal: (config) => {3 return nextConfig(config);4 },5};6const path = require('path');7module.exports = ({ config }) => {8 config.module.rules.push({9 test: /\.(ts|tsx)$/,10 include: path.resolve(__dirname, '../'),11 {12 loader: require.resolve('babel-loader'),13 options: {14 presets: [['react-app', { flow: false, typescript: true }]],15 },16 },17 {18 loader: require.resolve('react-docgen-typescript-loader'),19 options: {20 propFilter: (prop) => {21 if (prop.parent) {22 return !prop.parent.fileName.includes('node_modules');23 }24 return true;25 },26 },27 },28 });29 config.resolve.extensions.push('.ts', '.tsx');30 return config;31};32const path = require('path');33module.exports = ({ config }) => {34 config.module.rules.push({35 test: /\.(ts|tsx)$/,36 include: path.resolve(__dirname, '../'),37 {38 loader: require.resolve('babel-loader'),39 options: {40 presets: [['react-app', { flow: false, typescript: true }]],41 },42 },43 {44 loader: require.resolve('react-docgen-typescript-loader'),45 options: {46 propFilter: (prop) => {47 if (prop.parent) {48 return !prop.parent.fileName.includes('node_modules');49 }50 return true;51 },52 },53 },54 });55 config.resolve.extensions.push('.ts', '.tsx');56 return config;57};58const path = require('path');59module.exports = ({ config }) => {60 config.module.rules.push({61 test: /\.(ts|tsx)$/,62 include: path.resolve(__dirname, '../'),63 {
Using AI Code Generation
1const { nextConfig } = require('@storybook/root-config');2module.exports = nextConfig({3 webpackFinal: async (config, { configType }) => {4 config.module.rules.push({5 include: path.resolve(__dirname, '../'),6 });7 return config;8 },9});10"scripts": {11 },12import React from 'react';13import { Button } from '../components/Button';14export default {15};16const Template = (args) => <Button {...args} />;17export const Primary = Template.bind({});18Primary.args = {19};20export const Secondary = Template.bind({});21Secondary.args = {
Using AI Code Generation
1module.exports = require('../storybook-root').nextConfig({2});3const path = require('path');4const withMDX = require('@next/mdx')({5});6module.exports = {7 nextConfig: (nextConfig = {}) => {8 return withMDX({9 webpack: (config, options) => {10 config.resolve.alias['@'] = path.resolve(__dirname, '../src');11 return config;12 },13 });14 },15};
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!