Skip to content

Instantly share code, notes, and snippets.

@smisyuk4
smisyuk4 / gist:01a6d4df24fb48d1a64083fd56f698c8
Created August 30, 2025 10:04
Redux TK Query + Redux Persist
// stote.tsx
import { combineReducers, configureStore } from '@reduxjs/toolkit';
import {
FLUSH,
PAUSE,
PERSIST,
PURGE,
REGISTER,
REHYDRATE,
persistReducer,
@smisyuk4
smisyuk4 / gist:47a1e5df08ac1fa228811cc5f1ad080e
Created July 1, 2025 15:49
embla slider - examle next js + tailwind
export interface Photo {
id: string;
photo: string;
alt: string;
}
const DATA: Photo[] = [
{
id: '1',
photo: '/images/Rectangle_15_329_351.webp',
@smisyuk4
smisyuk4 / gist:4cae4c28223fa6d637b6f48deb81e579
Last active May 11, 2025 20:17
RTK query + Firebase different collections
1. Структура директорій (модульна)
/src
/store
store.ts
/services
usersApi.ts
postsApi.ts
commentsApi.ts
messagesApi.ts
import { createApi, fakeBaseQuery } from '@reduxjs/toolkit/query/react';
import { db } from '../firebase/firebase.config';
import {
collection,
query,
where,
collectionGroup,
updateDoc,
deleteDoc,
getDocs,
import { useState } from 'react';
import { Icon } from '../Icon';
import { DivStyled, IconWrp, GasketStyled } from './RatingBar.styled';
export const RatingBar = () => {
const [rate, setRate] = useState(0);
return (
<>
<label>
@smisyuk4
smisyuk4 / gist:f05f124f0941e21ae1792db4f60249f9
Last active February 21, 2024 23:26
pulse animated button
========================> 1 file:
import { useState } from "react";
import PropTypes from "prop-types";
import { Button } from "./Button.styled";
export default function ButtonStyled({ text }) {
const [animationClass, setAnimationClass] = useState("");
const handleClick = ({nativeEvent}) => {
@smisyuk4
smisyuk4 / gist:b90486124b21df8f02d65bef07e3ae2c
Last active February 11, 2024 14:34
block border-radius in input
У input (всі типи) і textArea деякі браузери роблять заокруглення кутів,
щоб це заблокувати - потрібно додати властивості до стилів:
border-radius: 0;
appearance: none;
-webkit-appearance: none;
@smisyuk4
smisyuk4 / gist:0759be2888aee6681df692650fbef44e
Created February 11, 2024 10:07
Navigation to section on page
1. До секції додати id='назва'
2. У панелі навігації використати
<a href='#назва' aria-label='перехід на секцію'>
секція
</a>
3. Не можна для цього випадку використовувати 'react-router-dom'
1. Додати файли у проект, у папку /assets/icons
2. У файлі index.css додати загальний курсор
body {
cursor: url('./assets/icons/cursor.png'), auto;
}
3. У місце де потрібно ховер курсор
import cursorIcon from '../../assets/icons/click-cursor.png';
export const UlStyled = styled.ul`
display: grid;
grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
grid-template-rows: repeat(2, minmax(200px, 1fr));
grid-auto-flow: column;
grid-gap: 16px;
overflow-x: auto;
grid-row-gap: 40px;
grid-column-gap: 60px;