From aba003db1de4c2c2dc79308bbaff86f08205199f Mon Sep 17 00:00:00 2001 From: martincai8 Date: Mon, 18 Nov 2024 23:49:10 -0800 Subject: [PATCH] maybe fix faqs? --- src/components/FaqBox.jsx | 107 +++++++++++++++++++++----------------- 1 file changed, 60 insertions(+), 47 deletions(-) diff --git a/src/components/FaqBox.jsx b/src/components/FaqBox.jsx index d54e270e..4a9cea86 100644 --- a/src/components/FaqBox.jsx +++ b/src/components/FaqBox.jsx @@ -2,21 +2,22 @@ import React from 'react' import styled from 'styled-components' const Container = styled.div` - font-family: "HK Grotesk", sans-serif; - text-align:left; + font-family: 'HK Grotesk', sans-serif; + text-align: left; background: white; - border:1.5px solid #FFF; - border-radius:5px; - box-sizing:border-box; - overflow:hidden; - ${p => p.expanded - ? ` + border: 1.5px solid #fff; + border-radius: 5px; + box-sizing: border-box; + overflow: hidden; + ${p => + p.expanded + ? ` border-color: #4B1B1B; ` - : ` + : ` border-color: #4B1B1B; `} - + &:not(:last-child) { margin-bottom: 20px; } @@ -24,72 +25,84 @@ const Container = styled.div` const Top = styled.div` color: #252525; - padding:1rem; - font-size:1.2rem; - display:flex; - justify-content:space-between; - border-bottom:solid; - margin-bottom:-1.2px; + padding: 1rem; + font-size: 1.2rem; + display: flex; + justify-content: space-between; + border-bottom: solid; + margin-bottom: -1.2px; font-weight: 700; - border-width:1px; - border-radius:5px 5px 0 0; - ${p => p.expanded && ` + border-width: 1px; + border-radius: 5px 5px 0 0; + ${p => + p.expanded && + ` color:#252525; background-color: #FFF; `} - + ${p => p.theme.mediaQueries.mobile} { font-size: 1rem; padding: 0.8rem; } &:hover { - cursor:pointer; + cursor: pointer; } ` const AnswerBox = styled.div` color: white; - box-sizing:border-box; - overflow:hidden; - transition:0.2s max-height cubic-bezier(.6,0,.4,1); + box-sizing: border-box; + overflow: hidden; + height: ${p => (p.isOpen ? 'auto' : '0')}; + visibility: ${p => (p.isOpen ? 'visible' : 'hidden')}; + opacity: ${p => (p.isOpen ? 1 : 0)}; + transition: opacity 0.2s ease; + background-color: #883030; border-radius: 0 0 5px 5px; - ${p => p.isOpen ? 'max-height:500px; background-color: #883030;' : 'max-height: 0;'} + ${p => p.theme.mediaQueries.mobile} { font-size: 0.9rem; } ` +const Answer = styled.div` + padding: 1rem; + height: fit-content; +` + const TopExpand = styled.div` - display:flex; - align-items:center; - transition:0.2s transform cubic-bezier(.6,0,.4,1); + display: flex; + align-items: center; + transition: 0.2s transform cubic-bezier(0.6, 0, 0.4, 1); ` // style={{ transform: `rotate(${false ? '0deg' : ''});` }} const Arrow = ({ color }) => ( - + ) const FaqBox = ({ question, answer, isExpanded, onExpand }) => ( - - - {question} - - - - - -
- {answer} -
-
-
- ) + + + {question} + + + + + + {answer} + + +) -export default FaqBox \ No newline at end of file +export default FaqBox