Skip to content

Commit b73e1bf

Browse files
authored
Merge pull request #113 from OCA-UFCG/refact/input-date
Update feedback from input date dates
2 parents e4f16b2 + de309b8 commit b73e1bf

File tree

4 files changed

+42
-13
lines changed

4 files changed

+42
-13
lines changed

next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
5+
// see https://nextjs.org/docs/basic-features/typescript for more information.

src/components/DateInput/DateInput.styles.tsx

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export const InputWrapper = styled.div`
2323
justify-content: center;
2424
gap: 0rem;
2525
width: 100%;
26-
// height: 2rem;
2726
`;
2827

2928
export const InputContainer = styled.div`
@@ -86,14 +85,39 @@ export const DateContainer = styled.div`
8685
display: flex;
8786
justify-content: space-between;
8887
align-items: end;
89-
height: 1.5rem;
88+
/* height: 1.5rem; */
9089
9190
position: relative;
9291
opacity: 0.7;
9392
`;
9493

95-
export const DateSpan = styled.span<{ year: string }>`
94+
export const Divider = styled.hr`
95+
border-bottom: 1px solid #000;
96+
transition: 300ms width ease-in-out;
97+
opacity: 0;
98+
width: 0px;
99+
margin: 0;
100+
`;
101+
102+
export const DateSpan = styled.p<{ isCurrent: string; active: string }>`
96103
font-size: 12px;
104+
margin: 0;
97105
color: ${({ theme }) => theme.colors.black};
98106
cursor: pointer;
107+
margin-top: 0.25rem;
108+
pointer-events: ${({ active }) => (active !== "true" ? "all" : "none")};
109+
110+
&:hover {
111+
font-weight: bold;
112+
}
113+
114+
& + ${Divider} {
115+
width: ${({ isCurrent }) => isCurrent === "true" && "100%"};
116+
opacity: ${({ isCurrent }) => isCurrent === "true" && "1"};
117+
}
118+
119+
&:hover + ${Divider} {
120+
width: 100%;
121+
opacity: 1;
122+
}
99123
`;

src/components/DateInput/DateInput.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
InputWrapper,
99
DateContainer,
1010
DateSpan,
11+
Divider,
1112
} from "./DateInput.styles";
1213

1314
const DateInput = ({
@@ -61,14 +62,19 @@ const DateInput = ({
6162
onChange={handleRangeChange}
6263
/>
6364
<DateContainer>
64-
{Object.keys(dates).map((date) => (
65-
<DateSpan
66-
key={date}
67-
year={date}
68-
onClick={() => updateFields(date)}
69-
>
70-
{date}
71-
</DateSpan>
65+
{Object.keys(dates).map((date, index) => (
66+
<div key={date}>
67+
<DateSpan
68+
isCurrent={(
69+
(index + 1).toString() === inputRef?.current?.value || false
70+
).toString()}
71+
active={isLoading.toString()}
72+
onClick={() => updateFields(date)}
73+
>
74+
{date}
75+
</DateSpan>
76+
<Divider />
77+
</div>
7278
))}
7379
</DateContainer>
7480
</InputWrapper>

src/components/MapsMenu/MapsMenu.styles.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export const Form = styled.form`
1212
flex-flow: column;
1313
box-sizing: border-box;
1414
width: 20rem;
15-
height: 100vh;
1615
padding-right: 0.3rem;
1716
1817
max-height: 24rem;

0 commit comments

Comments
 (0)