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

fix: SideBar styled-components props error 해결 #64

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/components/Content.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const Content = ({
<HelpIcon src={bulb_icon} />
</HelpButton>
</TapWrapper>
<ContentWrapper isModal={isModal} bgColor={bgColor}>
<ContentWrapper bgColor={bgColor}>
{isModal ? (
<HelpModal isModal={isModal} helpMsg={helpMessage} />
) : (
Expand Down Expand Up @@ -258,7 +258,6 @@ const ContentWrapper = styled.div`
border-radius: 25px;
background-color: ${({ theme, bgColor }) => theme.colors[bgColor]};
`;

const ScenarioBox = styled.div`
width: 100%;
height: 140px;
Expand Down
22 changes: 14 additions & 8 deletions src/components/ProgressRateBar.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import styled from 'styled-components';

const ProgressRateBar = ({ text_size, width, height, rate, ...attrProps }) => {
const ProgressRateBar = ({
$text_size,
$width,
$height,
rate,
...attrProps
}) => {
return (
<BarBox {...attrProps}>
<RateTitle text_size={text_size}>진도율</RateTitle>
<Bar_background width={width} height={height}>
<Bar_value height={height} value={rate} />
<RateTitle $text_size={$text_size}>진도율</RateTitle>
<Bar_background $width={$width} $height={$height}>
<Bar_value $height={$height} value={rate} />
</Bar_background>
</BarBox>
);
Expand All @@ -18,23 +24,23 @@ const BarBox = styled.div`
justify-content: space-evenly;
`;
const RateTitle = styled.p`
font-size: ${({ text_size }) => text_size}px;
font-size: ${({ $text_size }) => $text_size}px;
font-weight: bold;
white-space: nowrap;
color: ${({ theme }) => theme.colors.TEXT_BLACK};
`;
const Bar_background = styled.div`
position: relative;
width: ${({ width }) => width}px;
height: ${({ height }) => height}px;
width: ${({ $width }) => $width}px;
height: ${({ $height }) => $height}px;
background-color: ${({ theme }) => theme.colors.BG_LIGHTGRAY};
border-radius: 8px;
overflow: hidden;
`;
const Bar_value = styled.div`
position: absolute;
width: ${({ value }) => value + `%`};
height: ${({ height }) => height}px;
height: ${({ $height }) => $height}px;
top: 0;
left: 0;
background-color: ${({ theme }) => theme.colors.BLUE};
Expand Down
23 changes: 14 additions & 9 deletions src/components/SideBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,24 @@ const SideBar = ({
<Title
key={content.id}
disabled={!content.isCompleted && index !== ableChapterIndex}
ableChapterIndex={ableChapterIndex}
currentChapterId={currentChapterId}
$ableChapterIndex={ableChapterIndex}
$currentChapterId={currentChapterId}
onClick={() => onClick(content.id)}
id={content.id}
index={index}
$index={index}
>
{index + 1}. {content.title}
</Title>
);
})}
</Contents>
<RateBarContainer>
<ProgressRateBar text_size={18} width={150} height={25} rate={rate} />
<ProgressRateBar
$text_size={18}
$width={150}
$height={25}
rate={rate}
/>
</RateBarContainer>
</SideBarContainer>
);
Expand Down Expand Up @@ -89,14 +94,14 @@ const Title = styled.button`
color: ${({
theme,
disabled,
ableChapterIndex,
currentChapterId,
$ableChapterIndex,
$currentChapterId,
id,
index,
$index,
}) => {
if (!disabled) {
if (id === currentChapterId) return theme.colors.BLUE;
else if (index === ableChapterIndex) return theme.colors.TEXT_BLACK;
if (id === $currentChapterId) return theme.colors.BLUE;
else if ($index === $ableChapterIndex) return theme.colors.TEXT_BLACK;
} else return theme.colors.LIGHTGRAY;
}};
cursor: ${({ disabled }) => (disabled ? `default` : `pointer`)};
Expand Down
6 changes: 2 additions & 4 deletions src/pages/Game/Type_FillBlank.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ const TypeFillBlank = ({

const onSubmit = async (event) => {
event.preventDefault();

await handleComplete(problemId, userAnswer);

setTimeout(() => {
setUserAnswer('');
}, 1000);
Expand All @@ -43,7 +41,7 @@ const TypeFillBlank = ({
<QuestionText>{parts[0]}</QuestionText>
<AnswerInput
placeHolder='정답'
answerlength={parts[1].length}
answerlengthprop={parts[1].length}
value={userAnswer}
onChange={(e) => setUserAnswer(e.target.value)}
autoFocus
Expand Down Expand Up @@ -91,7 +89,7 @@ const QuestionText = styled.p`
font-weight: 400;
`;
const AnswerInput = styled.input`
width: ${({ answerlength }) => answerlength * 35}px;
width: ${({ answerlengthprop }) => answerlengthprop * 35}px;
height: 35px;
padding: 5px;
border: none;
Expand Down