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

Make 'Renew' button responsive #561

Merged
merged 3 commits into from
Apr 10, 2023

Conversation

SerpentBytes
Copy link
Contributor

Description

Resolves #555 by making the 'Renew Certificate' button responsive

Steps to Test

  • Run the project
  • Request a certificate
  • Resize browser screen to mock different viewports:
Screen.Recording.2023-04-10.at.4.21.15.PM.mov

@SerpentBytes SerpentBytes requested review from humphd, Ririio, Eakam1007 and a user April 10, 2023 20:24
@SerpentBytes SerpentBytes marked this pull request as ready for review April 10, 2023 20:26
@SerpentBytes SerpentBytes added category: front end Front end part of our web service area: web Web development related things [front end/back end] labels Apr 10, 2023
@SerpentBytes SerpentBytes self-assigned this Apr 10, 2023
@SerpentBytes SerpentBytes added this to the Milestone 1.0a milestone Apr 10, 2023
Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like how you used Wrap for this, and think we can simplify this component tree a bit. This works similar to what you have, but drops a few Flex components:

diff --git a/app/components/certificate/description.tsx b/app/components/certificate/description.tsx
index 0f3485a..574fc40 100644
--- a/app/components/certificate/description.tsx
+++ b/app/components/certificate/description.tsx
@@ -9,6 +9,7 @@ import {
   StatLabel,
   StatNumber,
   WrapItem,
+  Wrap,
 } from '@chakra-ui/react';
 
 interface DescriptionSectionProps {
@@ -29,30 +30,24 @@ export default function DescriptionSection({
   return (
     <Flex flexDirection="column" gap="3" marginTop={{ base: 1, md: 5 }} fontSize="md">
       <Text maxW={600}>{description}</Text>
-      {certRequested && (
-        <HStack gap="6" marginTop="2" flexWrap="wrap">
-          {!!validFromFormatted && !!validToFormatted && (
-            <>
-              <Stat backgroundColor="whitesmoke" maxW={200} px={5} py={3} borderRadius={8}>
-                <StatLabel>Created On</StatLabel>
-                <StatNumber>{validFromFormatted}</StatNumber>
-              </Stat>
-              <Stat backgroundColor="whitesmoke" maxW={200} px={5} py={3} borderRadius={8}>
-                <StatLabel>Expires On</StatLabel>
-                <StatNumber>{validToFormatted}</StatNumber>
-              </Stat>
-              <WrapItem>
-                <Flex justifyContent="flex-end">
-                  <Form method="post">
-                    <Button type="submit" rightIcon={<RepeatIcon />} isDisabled={!isRenewable}>
-                      Renew Certificate
-                    </Button>
-                  </Form>
-                </Flex>
-              </WrapItem>
-            </>
-          )}
-        </HStack>
+      {certRequested && !!validFromFormatted && !!validToFormatted && (
+        <Wrap align="center">
+          <Stat backgroundColor="whitesmoke" maxW={200} px={5} py={3} borderRadius={8}>
+            <StatLabel>Created On</StatLabel>
+            <StatNumber>{validFromFormatted}</StatNumber>
+          </Stat>
+          <Stat backgroundColor="whitesmoke" maxW={200} px={5} py={3} borderRadius={8}>
+            <StatLabel>Expires On</StatLabel>
+            <StatNumber>{validToFormatted}</StatNumber>
+          </Stat>
+          <WrapItem>
+            <Form method="post">
+              <Button type="submit" rightIcon={<RepeatIcon />} isDisabled={!isRenewable}>
+                Renew Certificate
+              </Button>
+            </Form>
+          </WrapItem>
+        </Wrap>
       )}
     </Flex>
   );

@SerpentBytes SerpentBytes marked this pull request as draft April 10, 2023 21:03
@SerpentBytes
Copy link
Contributor Author

SerpentBytes commented Apr 10, 2023

I tried this first, but it reduces the space between components:
Screenshot 2023-04-10 at 6 39 13 PM

@SerpentBytes SerpentBytes requested a review from humphd April 10, 2023 22:40
@SerpentBytes SerpentBytes marked this pull request as ready for review April 10, 2023 23:10
Copy link
Contributor

@Myrfion Myrfion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SerpentBytes SerpentBytes merged commit e49c185 into DevelopingSpace:main Apr 10, 2023
@SerpentBytes SerpentBytes deleted the issue-555 branch April 10, 2023 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: web Web development related things [front end/back end] category: front end Front end part of our web service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Certificate page renew button is not responsive
3 participants