Skip to content

harrytran998/dev-experiences

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

THANK TO REACT-BOILERPLATE

  • Với mục đích ghi chép kinh nghiệm trong quá trình làm việc để lưu trữ cho các bạn tìm hiểu sau này cũng như phục vụ công việc mentor của bản thân sau này!
  • Bài viết hoàn toàn từ kinh nghiệm nên sẽ không phải là bài viết lý thuyết xuông mà còn đưa ra ví dụ cụ thể.

Các bài viết về React

#-------Dưới đây chỉ là nháp cá nhân thôi, các bạn không cần phải quan tâm--- https://stackoverflow.com/questions/37937984/git-refusing-to-merge-unrelated-histories-on-rebase https://stackoverflow.com/questions/10697463/resolve-git-merge-conflicts-in-favor-of-their-changes-during-a-pull https://stackoverflow.com/questions/32370994/how-to-pass-props-to-this-props-children https://devhints.io/sass Draff:

{
  test: /\.json/,
  type: 'javascript/auto',
  exclude: /node_modules|bower_components/,
  use: [require.resolve('json-loader')],
},

babel 7 có nhiều thứ hay ho như <></> render React.Fragment, suport TS.

  • babel-plugin-proposal-optional-chaining cái này siêu hay, trước phải a && a.b && a.b.c thì bây giờ chỉ cần a?.b?.c thôi hoặc onHandle && onHandle() thì chỉ cần onHandle?.()
  • babel-plugin-proposal-logical-assignment-operators cũng khá ngầu nhưng chắc ít dùng trước: a = a || b, thì bây giơ sẽ chỉ cần a ||= b, tương tự, a = a && b thì chỉ cần a &&= b;, khá cool.
  • @babel/preset-typescript cái này setting thương tự @babel/preset-flow, vậy là từ đây, React ngày càng flexible
  • <></> ????.

Với template, Ví dụ: chuỗi string <div>Tôi là {{ name }}</div> thì có thể sử dụng nhiều template hbs.

  • npm i handlebars
import Handlebars from 'handlebars';

export const fillVariables = (template, variables) => Handlebars.compile(template)(variables);
  • config webpack.
{
...
  node: {
    fs: 'empty'
  }
...
}

html2pdf

export const dataURItoBlob = dataURI => {
  // convert base64/URLEncoded data component to raw binary data held in a string
  let byteString;
  if (dataURI.split(',')[0].indexOf('base64') >= 0) {
    byteString = atob(dataURI.split(',')[1]);
  } else {
    byteString = unescape(dataURI.split(',')[1]);
  } 

  // separate out the mime component
  const mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];

  // write the bytes of the string to a typed array
  const ia = new Uint8Array(byteString.length);
  for (var i = 0; i < byteString.length; i++) {
    ia[i] = byteString.charCodeAt(i);
  }

  return new Blob([ia], { type: mimeString });
};

export const createPDFFile = (dataURI, filename) =>
  new File([dataURItoBlob(dataURI)], filename, { type: 'application/pdf' }); 
import html2PDF from 'html2pdf.js';
import Handlebars from 'handlebars';
import { createPDFFile } from './create-pdf-file';

export const fillVariables = (template, variables) => Handlebars.compile(template)(variables);

export const renderPDFWithDownload = (template, filename, variables) => {
  html2PDF()
    .from(fillVariables(template, variables))
    .toPdf()
    .save(filename);
};

export const renderPDFWithCallback = (template, filename, variables, callback) => {
  html2PDF()
    .from(fillVariables(template, variables))
    .toPdf()
    .output('datauristring')
    .then(blobData => callback(createPDFFile(blobData, `${filename}.pdf`)));
};
import InlineEditor from '@ckeditor/ckeditor5-build-inline';

InlineEditor
    .create(document.querySelector('.ck-editor'), { toolbar: ['heading', '|', 'bold', 'italic', 'link']})
    .then(editor => window.editor = editor);

  1. Plugin hover css (Tạo hiệu ứng khi rê chuột - vào) : http://ianlunn.github.io/Hover/
  2. Plugin Animate.css (Tổng hợp 1 số animate css, cũng là hiệu ứng):
  1. Owl carousel (Slider cho website) :
  1. Slick slider (Slider cho website - nhẹ hơn owl carousel, bác nào thích hiệu ứng có thể dùng owl carousel, thích đơn giản thì dùng thằng này) :
  1. Plugin Wow js (Tạo hiệu ứng xuất hiện khi cuộn trang) :
  1. Plugin Isotope (Tạo hiệu ứng mỗi khi click vào filter) :
  1. Direction Reveal (Tạo hiệu ứng khi rê chuột vào sẽ theo hướng di chuyển của chuột - xem demo để rõ hơn) :
  1. Plugin Scroll With Ease (Tạo hiệu ưng ease khi lăn chuột) :
  1. Font Awesome Animation (Hiệu ứng cho Font Awesome):
  1. Framework Material Design for Bootstrap (Bản custom bootstrap với material design) :
  1. Materialize (Framework với phong cách material design) :
  1. Plugin ScrollReveal (Tạo hiệu ưng xuất hiện khi cuộn trang giống Wow js nhưng cái này có độ delay từng phần tử ):
  1. Keyframes (Tạo animation có bản web và bản extension chrome) :
  1. Plugin Tilt (Tạo hiệu ứng parallax khi rê chuột vào phần tử) :
  1. Plugin Particles (Tạo hiệu ứng ngân hà Một số plugin front end chủ yếu thiên về UI:v theo em thì là vậy) :
  1. Plugin LegitRipple (Tạo hiệu ứng ripple wave khi click vào phần tử) :
  1. Plugin Splitting (Tạo hiệu ứng text, image, list.... cho website) :
  1. Plugin Fancybox (Tạo hiệu ứng khi xem ảnh) :
  1. Plugin Anime JS (Tạo hiệu ứng cho phần tử) :

http://cssnext.io/features/


Install nvm in macOS https://www.codementor.io/mercurial/how-to-install-node-js-on-macos-sierra-mphz41ekk

About

Dev Experiences

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published