class CompilerCommand() -> .run_command("compiler")
class HelperCompilerCommand() -> .run_command("helper_compiler")
class CompilerHelperCommand() -> .run_command("compiler_helper")
import React, { useState } from "react";
const MemoID = ({ getID }) => {
return Array.from(new Array(getID)).map((_, i) => {
return <p key={i}> {i} </p>;
});
};
export default function App() {
let [getID, setID] = useState(0);
return (
<>
<MemoID key={getID} {...{ getID }} />
<button onClick={() => setID(getID + 1)}> clickMe </button>
</>
);
}
//css
.submit.myStyles1 {
}
.submit.myStyles2 {
}
.submit.myStyles3 {
}
const myfunction1 = () => {}
const myfunction2 = () => {}
const PhoneBTN = ({phone}) => (
<a className="phone" href={`tel:${phone}`}>
<img src="./Assets/Phone.svg" alt="" />
</a>
)
const Button = ({type,text}) => {
return (
type === "phone" ?
<PhoneBTN {...{phone:text}} onClick={myfunction1}/>:
<button className="submit myStyles" onClick={myfunction2}>{text}</button>
)
}
const render = () => (
<Button {...{type:"phone",text:""}}/>
)
const buttons = document.querySelectorAll('ul.sidebar-menu > li');
const divs = document.querySelectorAll('div.services-info>div.content>div');
buttons.forEach( (btn,i) => {
btn.onclick = _ => {
for(let j = divs.length; j--;) {
const divsName = divs[j].classList[0];
divsName == btn.id ?
divs[j].classList.add('visible'):
divs[j].classList.remove('visible')
}
}
})
//index.js
import React from "react";
import { render } from "react-dom";
// import react router
import { BrowserRouter, Link } from "react-router-dom";
import toLinkParams from "./toLinkParams";
const params = {
pathname: "/signup",
search: toLinkParams({
lang: "ua",
source: "3",
offer: 1,
country: "ua"
})
};
const App = () => (
<BrowserRouter>
<div className="sans-serif">
<Link to={params}>Button</Link>
</div>
</BrowserRouter>
);
render(<App />, document.getElementById("root"));
//toLinkParams.js
export default function toLinkParams(params) {
return (
"?" +
Object.entries(params)
.map((param) => {
const [key, value] = param;
return `${key}=${value}`;
})
.join("&")
);
}
<template>
<div className="container">
<h1>Portfolio</h1>
<ul class="portfolio__video-item">
<li
v-for="video in mainVideo"
v-bind:key="video.id"
class="portfolio__video-item__subitem"
>
<img v-bind:src="video.img" />
<div class="portfolio__video-descr">
<div class="portfolio__video-descr__title">
{{ video.title }}
</div>
<div class="portfolio__video-descr__subtitle">
<span>
{{ video.subtitle }}
</span>
</div>
</div>
</li>
</ul>
<div
class="modal"
v-for="modal in modals"
v-bind:key="modal.id"
>
<div class="modal__close">×</div>
<div class="modal__wrapper" >
<div class="modal__player">
<iframe
class="modal__player-item"
v-bind:src="modal.url"
></iframe>
</div>
<div class="modal__descr-block">
<h2 class="modal__descr-block__subtitle">
<span>{{ modal.title }}</span>
</h2>
<div class="modal__descr-block__descr">
<span>{{ modal.description }}</span>
</div>
</div>
</div>
</div>
</div>
</template>
.slider {
width: 100%;
display: flex;
justify-content: center;
overflow:hidden;
}
или
.slider-wrapper {
overflow:hidden;
max-width: 800px;
width: 100%;
height: 120px;
position: relative;
box-shadow: 10px 10px 44px -10px rgba(0,0,0,0.75);
}
const SECTIONS = ['top','bottom','head','shoes','bag','accs',];
const prepareShareItems = ({person,items}) => {
for (var i = 0 , res = {} ; i < SECTIONS.length; i++) {
const {slide,list} = person[SECTIONS[i]];
Object.assign(res,{[SECTIONS[i]]: items.find((item) => item.id === list[slide]).image})
}
return res;
};
prepareShareItems(store.getState().globals)
<nav>
<ul>
<li class="sectButton"> <a href="#one">1</a></li>
<li class="sectButton"> <a href="#two">2</a> </li>
<li class="sectButton"> <a href="#three">3</a></li>
<li class="sectButton"> <a href="#four">4</a></li>
</ul>
</nav>
<main>
<div class="main_wrapper" style="scroll-behavior: smooth;">
<section id="one">1</section>
<section id="two">2</section>
<section id="three">3</section>
<section id="four">4</section>
</div>
</main>
import React, { useState } from "react";
export default function App() {
let [getID,setID] = useState(0);
return (
<>
<p> {getID} </p>
<button onClick={ () => setTimeout(() => setID(getID + 1),800)} > clickMe </button>
</>
)
}
import React, { useState } from "react";
const MemoID = ({getID}) => {
return Array.from(new Array(getID)).map( (_,i) => {
return (<p key={i}> {i} </p>)
})
}
export default function App() {
let [getID,setID] = useState(0);
return (
<>
<MemoID key={getID} {...{getID}}/>
<button onClick={ () => setTimeout(() => setID(getID + 1),800)} > clickMe </button>
</>
)
}
span {
transition: 1s;
opacity: 0;
}
<h1 id="giveText"></h1>
const giveText = document.getElementById("giveText")
const myTEXT = "задайте свой текст";
window.onload = () => {
myTEXT.split(" ").forEach( (word,i) => {
giveText.innerHTML += ` <span>${word}</span>`
setTimeout( () => {
giveText.children[i].setAttribute("style","opacity:1")
},(i+1)*600)
})
}
{
"name": "yourProject",
"version": "1.0.0",
"description": "",
"main": "webpack.config.js",
"scripts": {
"dev": "webpack serve --mode development",
"build": "webpack serve --mode production",
"watch": "webpack serve --mode development --watch"
},
"author": "",
"license": "ISC",
"devDependencies": {
"css-loader": "^5.2.5",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.3.1",
"node-sass": "^6.0.0",
"sass-loader": "^11.1.1",
"style-loader": "^2.0.0",
"url-loader": "^4.1.1",
"vue": "^2.6.12",
"vue-loader": "^15.9.7",
"vue-loader-plugin": "^1.3.0",
"vue-template-compiler": "^2.6.12",
"webpack": "^5.37.1",
"webpack-cli": "^4.7.0",
"webpack-dev-server": "^3.11.2"
}
}
const path = require('path');
const HTMLWebpackPlugin = require('html-webpack-plugin');
const {VueLoaderPlugin} = require('vue-loader');
module.exports = {
mode:'development',
devtool: false,
performance: {
maxEntrypointSize: 512000,
maxAssetSize: 512000
},
entry: ["./src/index.js","./src/assets/js/main.js"],
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist'),
},
plugins: [
new HTMLWebpackPlugin({template: "./src/index.html"}),
new VueLoaderPlugin(),
],
resolve: {
extensions:['.js','.scss','.vue', '.svg', '.png', '.jpg','...'],
alias: {
vue: 'vue/dist/vue.js'
},
},
module: {
rules: [
{
test:/\.vue$/,
use: ['vue-loader']
},
{
test: /\.scss$/,
use: ['vue-style-loader','style-loader','css-loader','sass-loader'],
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
use: [{
loader:'url-loader',
options: {
name: '[name].[ext]',
outPath: './src/assets/imgs',
publicPath: './src/assets/imgs',
emitFile: true,
esModule: false,
}
}]
},
{
test: /\.(ttf|woff|woff2|eot)/,
use: ['file-loader'],
},
]
}
}