Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature/BAR-244] 끄적이는 페이지 메모 작성시 하단으로 스크롤 이동 및 툴팁 적용 #76

Merged
merged 12 commits into from
Feb 21, 2024
Merged
18 changes: 16 additions & 2 deletions pages/main/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from 'react';
import { useEffect, useRef, useState } from 'react';

import WriteInput from '@components/Input/WriteInput';
import Layout from '@components/Layout';
Expand All @@ -18,19 +18,33 @@ import { COLORS } from '@styles/tokens';
const MainPage = () => {
useGetMyProfile();

const writeContentRef = useRef<HTMLDivElement>(null);
const writeInput = useInput({ id: 'write-input' });
const { todayMemos, history } = useGetWriteHistory();
const { mutate: submitTemporalMemo } = useCreateTemporalMemo();
const { data: memoFolders } = useGetMemoFolders();

const [selectedTab, setSelectedTab] = useState('끄적이는');

useEffect(() => {
handleScroll();
}, [todayMemos]);

const handleScroll = () => {
if (writeContentRef.current) {
writeContentRef.current.scrollTop = writeContentRef.current.scrollHeight;
}
};

const handleTabSelect = (selectedTab: string) => {
setSelectedTab(selectedTab);
};

const handleSubmit = () => {
submitTemporalMemo(writeInput.value);
writeInput.reset();

handleScroll();
};

const backgroundColor =
Expand All @@ -41,7 +55,7 @@ const MainPage = () => {
<MainPageTab
write={
<div className={styles.container}>
<div className={styles.content}>
<div ref={writeContentRef} className={styles.content}>
<WriteGuide />
<TemporalMemoHistoryTable
data={history}
Expand Down
1 change: 1 addition & 0 deletions src/domain/저장하는/components/ArchiveFolder/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const ArchiveFolder = ({ folders }: ArchiveFolderProps) => {
href={`${ROUTES.ARCHIVE}?folder=${folder.id}`}
className={styles.userFolder({
isActive:
router.asPath === `${ROUTES.ARCHIVE}` ||
router.asPath === `${ROUTES.ARCHIVE}?folder=${folder.id}`,
})}
>
Expand Down
5 changes: 5 additions & 0 deletions src/domain/저장하는/components/ArchiveFolder/style.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export const userFolder = recipe({
gap: '5px',
padding: '8px 20px',
borderRadius: '8px',
transition: 'all 100ms ease-in-out',

':hover': {
backgroundColor: COLORS['Grey/100'],
},
},
],
variants: {
Expand Down
2 changes: 1 addition & 1 deletion src/styles/global.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ globalStyle('body', {
});

globalStyle('h1, h2, h3, h4, h5, h6, p', {
wordBreak: 'keep-all',
wordBreak: 'break-word',
whiteSpace: 'pre-wrap',
});

Expand Down
Loading