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] 알림 발송 Modal 구현 #115

Merged
merged 14 commits into from
Nov 2, 2024
Merged
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
296 changes: 158 additions & 138 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file modified .yarn/install-state.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@sopt-makers/colors": "^3.0.1",
"@sopt-makers/fonts": "^2.0.1",
"@sopt-makers/icons": "^1.0.4",
"@sopt-makers/ui": "^2.0.0",
"@sopt-makers/ui": "^2.4.0",
"axios": "^1.3.4",
"dayjs": "^1.11.9",
"eslint-config-next": "^14.1.4",
Expand Down
12 changes: 0 additions & 12 deletions src/components/alarmAdmin/AlarmList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,6 @@ function AlarmList(props: Props) {
}
};

const onSendAlarm = async (alarmId: number, title: string) => {
const response = window.confirm(`${title} 알림을 전송하시겠습니까?`);
if (response) {
setIsSending(true);
const result = await sendAlarm(alarmId);
setIsSending(false);
window.alert(result ? '전송에 성공했습니다' : '전송에 실패했습니다');
refetch();
}
};

const onShowAlarmDetail = (alarmId: number) => {
setShowAlarmDetail(alarmId);
};
Expand Down Expand Up @@ -122,7 +111,6 @@ function AlarmList(props: Props) {
text="전송"
onClick={(e) => {
e.stopPropagation();
onSendAlarm(alarm.alarmId, alarm.title);
}}
disabled={alarm.status === '발송 후'}
/>
Expand Down
78 changes: 78 additions & 0 deletions src/components/alarmAdmin/CreateAlarmModal/DatePickerSelect.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import styled from '@emotion/styled';
import { colors } from '@sopt-makers/colors';
import { fontsObject } from '@sopt-makers/fonts';
import { IconChevronDown } from '@sopt-makers/icons';
import React from 'react';

interface DatePickerSelectProps {
selectedDate: string | null;
placeholder: string;
open: boolean;
}

function DatePickerSelect({
selectedDate,
placeholder,
open,
}: DatePickerSelectProps) {
const selectedLabel = selectedDate ? selectedDate : placeholder;

return (
<DatePickerSelectButton>
<DatePickerSelectWrapper>
<DatePickerSelectLabel isSelected={selectedDate !== null}>
{selectedLabel}
</DatePickerSelectLabel>
<IconChevronDown
style={{
width: 20,
height: 20,
transform: open ? 'rotate(-180deg)' : '',
transition: 'all 0.3s ease',
}}
/>
</DatePickerSelectWrapper>
</DatePickerSelectButton>
);
}

export default DatePickerSelect;

const DatePickerSelectButton = styled.button`
width: 100%;
height: 100%;
background: none;
border: none;
padding: 0;
margin: 0;
cursor: pointer;
`;

const DatePickerSelectWrapper = styled.div`
width: 100%;
height: 100%;

${fontsObject.BODY_2_16_M};
color: ${colors.white};

border-radius: 10px;

border: 1px solid transparent;
padding: 11px 16px;
display: flex;
justify-content: space-between;
align-items: center;
gap: 12px;
cursor: pointer;
transition: border 0.2s;

background-color: ${colors.gray700};

&:focus {
border: 1px solid ${colors.gray200};
}
`;

const DatePickerSelectLabel = styled.p<{ isSelected: boolean }>`
color: ${({ isSelected }) => !isSelected && colors.gray300};
`;
58 changes: 58 additions & 0 deletions src/components/alarmAdmin/CreateAlarmModal/LabeledComponent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import styled from '@emotion/styled';
import { colors } from '@sopt-makers/colors';
import { fontsObject } from '@sopt-makers/fonts';
import { ReactNode } from 'react';

interface LabelProps {
labelText: string;
desc?: string;
children?: ReactNode;
}

function LabeledComponent({ labelText, desc, children }: LabelProps) {
return (
<LabeledComponentWrapper>
<LabelWrapper>
<LabelText>{labelText}</LabelText>
<RequiredStar>*</RequiredStar>
</LabelWrapper>
{desc && (
<DescWrapper>
<DescText>{desc}</DescText>
</DescWrapper>
)}
{children}
</LabeledComponentWrapper>
);
}

export default LabeledComponent;

const LabeledComponentWrapper = styled.div`
display: flex;
flex-direction: column;
`;

const LabelWrapper = styled.label`
display: flex;
gap: 0.4rem;
`;

const DescWrapper = styled.label`
margin: 0.8rem 0;
`;

const DescText = styled.span`
${fontsObject.LABEL_4_12_SB}
color: ${colors.gray300};
`;

const LabelText = styled.span`
${fontsObject.LABEL_3_14_SB}
color: ${colors.white};
`;

const RequiredStar = styled.span`
${fontsObject.LABEL_3_14_SB}
color: ${colors.secondary};
`;
Loading