diff --git a/apps/web/public/hamburger.png b/apps/web/public/hamburger.png new file mode 100644 index 00000000..805d2eb6 Binary files /dev/null and b/apps/web/public/hamburger.png differ diff --git a/apps/web/src/components/CommunityCard/CommunityCard.tsx b/apps/web/src/components/CommunityCard/CommunityCard.tsx index b8e5c86e..5403e48e 100644 --- a/apps/web/src/components/CommunityCard/CommunityCard.tsx +++ b/apps/web/src/components/CommunityCard/CommunityCard.tsx @@ -3,12 +3,13 @@ import Image from "next/image"; import {Badge} from "../Badge"; import {CommunityCardProps} from "./types"; import * as utils from "../../utils"; +import {md_screen_image, md_screen_wrapper, sm_screen_image, sm_screen_wrapper} from "./style"; export const CommunityCard = (props: CommunityCardProps) => { return (
+ className={`flex flex-col-reverse h-full min-h-[246px] border hover:drop-shadow-xl rounded-2xl bg-white mx-auto ${md_screen_wrapper} ${sm_screen_wrapper}`}>

@@ -35,7 +36,7 @@ export const CommunityCard = (props: CommunityCardProps) => {

{ const {style} = props; const router = useRouter(); const dispatch = useAppDispatch(); + const isLeftPanelVisible = useAppSelector((state) => state.responsiveToggles.leftPanelToggle) + useEffect(() =>{ + props.handleMargin(isLeftPanelVisible); + },[isLeftPanelVisible]) return (
void; }; diff --git a/apps/web/src/components/Search/Search.tsx b/apps/web/src/components/Search/Search.tsx index 351d17c1..c09645ce 100644 --- a/apps/web/src/components/Search/Search.tsx +++ b/apps/web/src/components/Search/Search.tsx @@ -2,7 +2,7 @@ import {SearchProps} from "./types"; export const Search = (props: SearchProps) => { return ( -
+
diff --git a/apps/web/src/pages/_app.tsx b/apps/web/src/pages/_app.tsx index 0a4847ef..36e7f1e4 100644 --- a/apps/web/src/pages/_app.tsx +++ b/apps/web/src/pages/_app.tsx @@ -26,6 +26,8 @@ import { store } from "../store"; import { LeftPanel } from "../components/LeftPanel"; import {UserProfileWrapper} from "../sections"; import {UpdateCommunityWrapper} from "../sections/UpdateCommunity"; +import {md_component} from "../styles/app_styels"; +import {useState} from "react"; const projectId = config.walletConnect.projectId; const chains = [ @@ -54,6 +56,10 @@ const client = createClient({ const ethereumClient = new EthereumClient(client, chains); const MyApp: AppType = ({ Component, pageProps }) => { + const [margin, setMargin] = useState(true); + const handleMargin = (value) =>{ + setMargin(value); + } return ( <> @@ -71,8 +77,8 @@ const MyApp: AppType = ({ Component, pageProps }) => { />
- -
+ +
diff --git a/apps/web/src/pages/index.tsx b/apps/web/src/pages/index.tsx index 482f986a..d006bf45 100644 --- a/apps/web/src/pages/index.tsx +++ b/apps/web/src/pages/index.tsx @@ -5,12 +5,14 @@ import {Search} from "../components/Search"; import {CommunityCard} from "../components/CommunityCard"; import {LoadMore} from "../components/Button/LoadMore"; import {useEffect} from "react"; -import {useAppSelector} from "../store"; +import {toggleLeftPanel, useAppDispatch, useAppSelector} from "../store"; import {isEmpty, isNil} from "lodash"; +import {index_title, md_index_container, md_index_grid} from "../styles/app_styels"; const Home: NextPage = () => { const newlyCreatedCommunity = useAppSelector((state) => state.community.newlyCreatedCommunity); - + const dispatch = useAppDispatch(); + const isLeftPanelVisible = useAppSelector((state) => state.responsiveToggles.leftPanelToggle) // @ts-ignore const {data, fetchNextPage, hasNextPage, refetch, isFetching} = trpc.public.fetchCommunities.useInfiniteQuery({ first: 10, @@ -31,15 +33,24 @@ const Home: NextPage = () => { fetchData(); }, [newlyCreatedCommunity]) + const handleLeftpanelToggle = () =>{ + dispatch(toggleLeftPanel(!isLeftPanelVisible)) + } return ( -
-

discover

-
+
+
+
+ {"hamburger"} +
+

discover

+
+ +
{ }}/>
-
+
{data?.pages?.map((page) => { return ( page?.edges?.map((community) => { diff --git a/apps/web/src/store/features/index.ts b/apps/web/src/store/features/index.ts index 9be0c918..524e7d3b 100644 --- a/apps/web/src/store/features/index.ts +++ b/apps/web/src/store/features/index.ts @@ -1,3 +1,4 @@ export * from "./community"; export * from "./user"; export * from "./profile"; +export * from "./responsive_toggles"; \ No newline at end of file diff --git a/apps/web/src/store/features/responsive_toggles.ts b/apps/web/src/store/features/responsive_toggles.ts new file mode 100644 index 00000000..14d426aa --- /dev/null +++ b/apps/web/src/store/features/responsive_toggles.ts @@ -0,0 +1,22 @@ +import type {PayloadAction} from '@reduxjs/toolkit'; +import {createSlice} from '@reduxjs/toolkit'; + +export interface ResponsiveToggles { + leftPanelToggle: boolean; +} +const initialState: ResponsiveToggles = { + leftPanelToggle: false, +}; + +export const responsiveTogglesSlice = createSlice({ + name: 'responsiveToggle', + initialState, + reducers: { + toggleLeftPanel: (state, action: PayloadAction) => { + state.leftPanelToggle = action.payload; + }, + }, +}); + +export const {toggleLeftPanel} = responsiveTogglesSlice.actions; +export default responsiveTogglesSlice.reducer; diff --git a/apps/web/src/store/store.ts b/apps/web/src/store/store.ts index c49fb5b5..585fe87a 100644 --- a/apps/web/src/store/store.ts +++ b/apps/web/src/store/store.ts @@ -3,6 +3,7 @@ import userReducer from "./features/user"; import communityReducer from "./features/community"; import profileReducer from "./features/profile"; import threadReducer from "./features/thread"; +import responsiveToggleReducer from "./features/responsive_toggles"; import {loadFromLocalStorage, saveToLocalStorage} from "./storage"; export const store = configureStore({ @@ -11,6 +12,7 @@ export const store = configureStore({ user: userReducer, profile: profileReducer, thread: threadReducer, + responsiveToggles: responsiveToggleReducer, }, preloadedState: loadFromLocalStorage(), }); diff --git a/apps/web/src/styles/app_styels.tsx b/apps/web/src/styles/app_styels.tsx new file mode 100644 index 00000000..d10debd2 --- /dev/null +++ b/apps/web/src/styles/app_styels.tsx @@ -0,0 +1,5 @@ +export const md_component = "max-680:ml-[0px]"; + +export const md_index_grid = "860-1001:grid-cols-3 521-861:grid-cols-2 min-1001:grid-cols-2"; +export const md_index_container = "max-680"; +export const index_title = "min-680:hidden"; \ No newline at end of file diff --git a/apps/web/tailwind.config.cjs b/apps/web/tailwind.config.cjs index 1d1904b8..86262f0e 100644 --- a/apps/web/tailwind.config.cjs +++ b/apps/web/tailwind.config.cjs @@ -7,6 +7,23 @@ module.exports = { accent: "#ff225b", }, }, + screens: { + 'sm': '640px', + 'md': '768px', + 'lg': '1024px', + 'xl': '1280px', + '2xl': '1536px', + 'tablet': {'min':'520px','max':'1001px'}, + 'mobile': {'max':'521px'}, + '860-1001': {'min':'860px','max':'1001px'}, + '521-861': {'min':'521px','max':'861px'}, + 'max-680': {'max':'680px'}, + 'min-680': {'min':'680px'}, + 'min-500': {'min':'500px'}, + 'min-1001': {'min':'1001px'}, + 'max-1000': {'max':'1000px'}, + // => @media (min-width: 1536px) { ... } + } }, plugins: [ require('@tailwindcss/line-clamp'),