File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,8 +66,8 @@ export default function Countdown({
6666 const remainingSecondsDisplay = remainingSeconds . toString ( ) . padStart ( 2 , '0' ) ;
6767
6868 const shouldDisplay = {
69- hour : ! ! remainingHours ,
70- minute : ! ! remainingHours || ! ! remainingMinutes ,
69+ hour : true ,
70+ minute : true ,
7171 } ;
7272
7373 const forceMinMax = ( event , ref ) => {
Original file line number Diff line number Diff line change 5555}
5656
5757.countdownCircle .content {
58+ width : 74% ;
59+ max-width : 190px ;
60+ margin : 0 auto;
5861 display : flex;
5962 flex-direction : column;
6063 align-items : center;
6164 justify-content : center;
6265 gap : 0.3rem ;
6366 text-align : center;
67+ box-sizing : border-box;
6468}
6569
6670.countdownCircle .content > span {
7175}
7276
7377.content .remainingTime {
74- display : flex;
75- align-items : flex-start;
76- justify-content : center;
77- gap : 0.2rem ;
78+ width : 100% ;
79+ display : grid;
80+ grid-template-columns : 1fr auto 1fr auto 1fr ;
81+ place-items : center;
82+ column-gap : 0.1rem ;
7883 margin-top : 0.05rem ;
7984}
8085
86+ .content .remainingTime > div {
87+ min-width : 0 ;
88+ width : 100% ;
89+ }
90+
8191.content .timeDisplay {
82- min-width : 2.8rem ;
92+ width : 100% ;
93+ min-width : 0 ;
8394 font-weight : 800 ;
84- font-size : 2.5 rem ;
95+ font-size : 1.7 rem ;
8596 line-height : 1 ;
8697 text-align : center;
98+ white-space : nowrap;
8799}
88100
89101.content .label {
90- margin-top : 0.25 rem ;
91- font-size : 0.72 rem ;
102+ margin-top : 0.2 rem ;
103+ font-size : 0.42 rem ;
92104 font-weight : 800 ;
93105 text-align : center;
94106 text-transform : uppercase;
95- letter-spacing : 0.05 em ;
96- line-height : 1.1 ;
107+ letter-spacing : 0.03 em ;
108+ line-height : 1.05 ;
97109 opacity : 0.95 ;
110+ white-space : nowrap;
98111}
99112
100113.content .timeColon {
101- margin-top : 0.05rem ;
102- font-size : 2rem ;
114+ font-size : 1.1rem ;
103115 font-weight : 800 ;
104116 line-height : 1 ;
117+ align-self : center;
118+ width : auto;
105119}
106120
107121.content .operators {
Original file line number Diff line number Diff line change @@ -36,8 +36,11 @@ describe('Countdown Component', () => {
3636 expect ( screen . getByText ( 'Goal: 01:00:00' ) ) . toBeInTheDocument ( ) ;
3737 expect ( screen . getByText ( 'Elapsed: 00:30:00' ) ) . toBeInTheDocument ( ) ;
3838 expect ( screen . getByText ( 'Time Remaining' ) ) . toBeInTheDocument ( ) ;
39- expect ( screen . getByText ( '00' ) ) . toBeInTheDocument ( ) ;
39+ expect ( screen . getAllByText ( '00' ) ) . toHaveLength ( 2 ) ;
4040 expect ( screen . getByText ( '30' ) ) . toBeInTheDocument ( ) ;
41+ expect ( screen . getByText ( 'Hours' ) ) . toBeInTheDocument ( ) ;
42+ expect ( screen . getByText ( 'minutes' ) ) . toBeInTheDocument ( ) ;
43+ expect ( screen . getByText ( 'seconds' ) ) . toBeInTheDocument ( ) ;
4144 } ) ;
4245
4346 it ( 'calls toggleTimer when the close button is clicked' , ( ) => {
@@ -51,9 +54,8 @@ describe('Countdown Component', () => {
5154 it ( 'displays correct remaining time based on props' , ( ) => {
5255 // eslint-disable-next-line react/jsx-props-no-spreading
5356 const { rerender } = render ( < Countdown { ...defaultProps } /> ) ;
54- expect ( screen . getByText ( '00' ) ) . toBeInTheDocument ( ) ; // Hours
57+ expect ( screen . getAllByText ( '00' ) ) . toHaveLength ( 2 ) ; // Hours and Seconds
5558 expect ( screen . getByText ( '30' ) ) . toBeInTheDocument ( ) ; // Minutes
56- expect ( screen . getByText ( '00' ) ) . toBeInTheDocument ( ) ; // Seconds
5759
5860 rerender (
5961 < Countdown
You can’t perform that action at this time.
0 commit comments