Skip to content

Instantly share code, notes, and snippets.

View TyT-NICK's full-sized avatar
💣
Repo has been planted

Artem Kuroptev TyT-NICK

💣
Repo has been planted
View GitHub Profile
@TyT-NICK
TyT-NICK / Button.module.scss
Last active June 19, 2023 11:55
Example: SCSS
@import 'styles/utils/mixins';
.button {
@include fontSize(16px, 24px);
@include flex(row, center, center);
background: $yellow500;
color: $gray900;
border: solid 1px rgb($gray900, 0);
display: inline-block;
@TyT-NICK
TyT-NICK / CallToAction.jsx
Last active March 21, 2023 10:32
Example: Component with extracted logic
import cn from 'classnames';
import PropTypes from 'prop-types';
import dynamic from 'next/dynamic';
import Illustration from 'UI/components/Illustration';
import { LINK_TYPE } from 'utils/constants/linkType';
import useProps from './utils/useProps';
import styles from './styles.module.scss';
const Contact = dynamic(() => import('./content/Contact'));
const GetBook = dynamic(() => import('./content/GetBook'));
@TyT-NICK
TyT-NICK / blogApi.js
Last active March 21, 2023 10:57
Example: Redux-tk queries with code-splitting
import isEqual from 'lodash/isEqual';
import uniqWith from 'lodash/uniqWith';
import { GRAPHQL_QUERY } from 'utils/contentful/graphqlQuery';
import {
getGraphqlResultArticles,
getGraphqlResultArticlesByTags,
getGraphqlResultTags,
getGraphqlResultTotalArticlesCount,
getGraphqlResultTotalArticlesCountByTags,
} from 'utils/contentful/helper';
@TyT-NICK
TyT-NICK / removeFieldsFromObject.js
Last active May 29, 2021 15:15
Removing fields from object using Spread and Rest operators
const removeFieldsFromObject = (obj, ...fieldNames) => {
let newObj = { ...obj };
fieldNames.forEach((x) => {
const { [x]: removed, ...rest } = newObj;
newObj = rest;
});
return newObj;
}