Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 13x 13x 3x 2x 1x 13x 13x | import { createSlice, type PayloadAction } from '@reduxjs/toolkit';
import { TOOLS } from '@/shared/constants';
export type BrushState = {
color: string;
size: number;
};
const initialState: BrushState = {
color: '#1F2937',
size: 4,
};
const brushSlice = createSlice({
name: TOOLS.BRUSH,
initialState,
reducers: {
setBrushColor(state, action: PayloadAction<string>) {
state.color = action.payload;
},
setBrushSize(state, action: PayloadAction<number>) {
state.size = action.payload;
},
resetBrushState: () => initialState,
},
});
export const { setBrushColor, setBrushSize, resetBrushState } = brushSlice.actions;
export const brushReducer = brushSlice.reducer;
|