Skip to content

Commit

Permalink
Added subtitle for work or break label (#87)
Browse files Browse the repository at this point in the history
* added subtitle component

* added interface and formatted

* Add return type to Subtitle

* Fixed formatting errors
  • Loading branch information
sar-mko authored Jan 12, 2024
1 parent cdbc98c commit 1cdd5bd
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Pages/Room/Room.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import PomoCounter from "../../components/PomoCounter/PomoCounter";
import { PomoCounterPosition } from "../../components/PomoCounter/PomoCounter.styled";
import TimerForm from "../../components/Controls/TimerForm";
import SettingsModal from "../../components/Modal/SettingsModal";
import Subtitle from "../../components/TimerTitle/Subtitle";

const Room = (props: RoomProps): JSX.Element => {
const {
Expand Down Expand Up @@ -224,7 +225,11 @@ const Room = (props: RoomProps): JSX.Element => {
isBreak={isBreak}
isPublicRoom={isPublicRoom}
/>

<Subtitle
isLoaded={isLoaded}
workGrey={workGrey}
isBreak={isBreak}
/>
<Timestamp
color={workGrey}
roomName={roomName}
Expand Down
18 changes: 18 additions & 0 deletions src/components/TimerTitle/Subtitle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { StyledSubtitle } from "./TimerTitle.styled";

interface SubtitleProps {
isLoaded: boolean;
workGrey: string;
isBreak: boolean;
}

const Subtitle = (props: SubtitleProps): JSX.Element => {
const { isLoaded, workGrey, isBreak } = props;
return (
<StyledSubtitle isLoaded={isLoaded} color={workGrey}>
{isBreak ? "BREAK" : "WORK"}
</StyledSubtitle>
);
};

export default Subtitle;
9 changes: 9 additions & 0 deletions src/components/TimerTitle/TimerTitle.styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,12 @@ export const TitleEditEmojiSize = styled.div<{
export const StyledEye = styled(FaRegEye)`
margin-right: 0.5rem;
`;

export const StyledSubtitle = styled.h4<{
color: string;
isLoaded: boolean;
}>`
text-align: center;
color: ${({ color }): string => color};
visibility: ${({ isLoaded }): string => (isLoaded ? "visible" : "hidden")};
`;

0 comments on commit 1cdd5bd

Please sign in to comment.