Skip to content

Instantly share code, notes, and snippets.

View bautistaaa's full-sized avatar
🎯
Focusing

bautistaaa

🎯
Focusing
View GitHub Profile
@bautistaaa
bautistaaa / index.ts
Created October 23, 2018 18:51
modify package json via schematics
import { Rule, SchematicContext, Tree, chain } from '@angular-devkit/schematics';
import {
addPackageJsonDependency,
NodeDependency,
NodeDependencyType,
} from '@schematics/angular/utility/dependencies';
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
import { dependencies } from '../dependencies';
function addDependencies(): Rule {
@bautistaaa
bautistaaa / dependencies.ts
Created October 23, 2018 18:52
lib versions for schematics
export const dependencies: { [key: string]: string } = {
'@ngx-translate/core': '^10.0.2',
lodash: '4.17.10',
'ngx-mask': '^6.5.15'
};
@bautistaaa
bautistaaa / add-vscode-files.ts
Last active October 24, 2018 12:36
schematic to add vscode files to your project
function addVsCodeSettings(): Rule {
return (tree: Tree, _context: SchematicContext) => {
const templateSource = apply(url('./files/.vscode'), [
move('./.vscode'),
forEach((fileEntry: FileEntry) => {
if (tree.exists(fileEntry.path)) {
_context.logger.warn(`Warning: you've overriden ${
fileEntry.path
}. If you did not mean
to do this, restore these files via source control immediately after this operation.`);
export function mySchematic(_options: any): Rule {
return (tree: Tree, _context: SchematicContext) => {
return chain([
addDependencies(),
addVsCodeSettings()
])(tree, _context);
};
}
version: 1
snapshot:
percy-css: |
[data-qa="experiment_panel"] {
display none !important;
}
"test:integration:finalize:percy": "percy finalize --all",
"test:integration:checkout": "npm run build:integration && LOG_LEVEL=fatal npm run serve & wait-on http://localhost:5100 && NODE_PATH=src percy exec -- cypress run --record --group checkout --spec 'cypress/integration/checkout/**/*'",
"test:integration:main": "npm run build:integration && LOG_LEVEL=fatal npm run serve & wait-on http://localhost:5100 && NODE_PATH=src percy exec -- cypress run --parallel --record --group main --spec 'cypress/integration/main/**/*'",
const debounceSearch = useRef(
_.debounce(searchTerm => {
searchCharacters(searchTerm).then(results => {
setIsSearching(false);
// Filter out results with no thumbnail
const filteredResults = results.data.results.filter(
result => result.thumbnail.path.indexOf("image_not_available") === -1
);
setResults(filteredResults);
});
import React, { Component } from 'react';
import './App.css';
import DummyStore from './dummy-store';
import Header from './Header';
import SidebarSection from './SidebarSection';
import NoteSection from './NoteSection';
class App extends Component {
constructor(props) {
super(props)
const links = [
{
label: 'Link',
path: '/link',
},
{
label: 'Link2',
path: '/link2',
},
{
const Sidebar = (props) => {
const { links } = props;
const [selectedMenus, setSelectedMenus] = useState([]);
const handleMenuSelection = (label, depth) => {
setSelectedMenus((selectedMenus) => {
const newSelectedMenus = [...selectedMenus];
// trim any menus after the depth
newSelectedMenus.length = depth;
if (label !== '') {
newSelectedMenus[depth] = label;