Custom react modal getting hidden behind service card - css

I'm building info modals for a website on the services page. The services page has 3 cards that have different options, heres that code from the services page.
React JS
<ServicesContainer id='services'>
<ServicesH1>Services</ServicesH1>
<ServicesWrapper>
<ServicesCard>
<ServicesIcon src={Icon1} />
<ServicesH2>Equine Therapy</ServicesH2>
<ServicesP>
Work with horses
</ServicesP>
<Button
to='services'
onClick={openInfoModal}
primary='true'
dark='true'
smooth={true}
duration={500}
spy={true}
exact='true'
offset={-80}
>
modal
</Button>
</ServicesCard>
<ServicesCard>
<ServicesIcon src={Icon2} />
<ServicesH2>Group Therapy</ServicesH2>
<ServicesP>
Group therapy.
</ServicesP>
<InfoModal showInfoModal={showInfoModal} setShowInfoModal={setShowInfoModal}/>
</ServicesCard>
<ServicesCard>
<ServicesIcon src={Icon3} />
<ServicesH2>Individual Therapy</ServicesH2>
<ServicesP>
Individual Therapy.
</ServicesP>
</ServicesCard>
</ServicesWrapper>
</ServicesContainer>
When the modal pops up it's hidden behind the 3rd card, i'm assuming it has something to do with the 3rd card coming after the InfoModal component/ the styling. I've tried setting the z-index to 900, messed with opacity as well with no luck. When I put the InfoModal component under the 3rd card it shows up on the 3rd (far right) column of the page off center which I definitely don't want. I've looked around trying to find a solution by maybe being able to identify the custom InfoModal component as a modal so it shows up in front of everything but was only able to find styled-react-modal, which i tried but it made so many errors about ecma script that I just had to remove it. I'm pretty bad with css but heres the InfoModal styled components code
const Background = styled.div`
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 1);
position: fixed;
display: flex;
justify-content: center;
align-items: center;
z-index: 10;
`;
const ModalWrapper = styled.div`
width: 800px;
height: 500px;
box-shadow: 0 5px 16px rgba(0, 0, 0, 1);
background: #fff;
color: #000;
display: grid;
grid-template-columns: 1fr;
position: relative;
z-index: 10;
border-radius: 10px;
`;
const ModalContent = styled.div`
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
line-height: 1.8;
color: #141414;
p {
margin-bottom: 1rem;
}
button {
padding: 10px 24px;
background: #141414;
color: #fff;
border: none;
}
`;
const CloseModalButton = styled(MdClose)`
cursor: pointer;
position: absolute;
top: 20px;
right: 20px;
width: 32px;
height: 32px;
padding: 0;
z-index: 10;
`;
the services styled components code
import styled from 'styled-components';
export const ServicesContainer = styled.div`
height: 800px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: #189AC0;
z-index: 1;
#media screen and (max-width: 768px) {
height: 1100px;
}
#media screen and (max-width: 480px) {
height: 1300px;
}
`;
export const ServicesWrapper = styled.div`
max-width: 1000px;
margin: 0 auto;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
align-items: center;
grid-gap: 16px;
padding: 0 50px;
z-index: 1;
#media screen and (max-width: 1000px) {
grid-template-columns: 1fr 1fr;
}
#media screen and (max-width: 768px) {
grid-template-columns: 1fr;
padding: 0 20px;
}
`;
export const ServicesCard = styled.div`
background: #fff;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
border-radius: 10px;
max-height: 340px;
padding: 30px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
transition: all 0.2s ease-in-out;
transform: scale(1.05);
z-index: 0.5;
&:hover {
transform: scale(1.05);
transition: all 0.2s ease-in-out;
cursor: pointer;
}
`;
export const ServicesIcon = styled.img`
height: 160px;
width: 160px;
margin-bottom: 10px;
`;
export const ServicesH1 = styled.h1`
font-size: 2.5rem;
color: #fff;
margin-bottom: 64px;
#media screen and (max-width: 480px) {
font-size: 2rem;
}
`;
export const ServicesH2 = styled.h2`
font-size: 1rem;
margin-bottom: 10px;
`;
export const ServicesP = styled.p`
font-size: 1rem;
text-align: center;
`;
I hope this isn't to much but if anyone is good with styling or react, would appreciate any feedback.

Related

In my React Project Animation is not working

I am new to React
In my React project I wrote a keyframes in app.js and in this project using styled Components
Section.js
import React from "react";
import styled from "styled-components";
function Section() {
return (
<Wrap>
<ItemText>
<h1>Model S</h1>
<p>Order Online</p>
</ItemText>
<Buttons>
<ButtonGroup>
<LeftButton>Custom Order</LeftButton>
<RightButton>Existing Inventory</RightButton>
</ButtonGroup>
<DownArrow src="/images/down-arrow.svg" />
</Buttons>
</Wrap>
);
}
export default Section;
const Wrap = styled.div`
width: 100vw;
height: 100vh;
background-size: cover;
background-image: url("images/model-s.jpg");
background-repeat: no-repeat;
background-position: center;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
`;
const ItemText = styled.div`
padding: 10vh;
text-align: center;
`;
const LeftButton = styled.div`
cursor: pointer;
background-color: rgba(23, 26, 32, 0.8);
color: white;
height: 40px;
width: 256px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
border-radius: 100px;
opacity: 0.85;
text-transform: uppercase;
font-size: 12px;
`;
const RightButton = styled(LeftButton)`
cursor: pointer;
`;
const ButtonGroup = styled.div`
display: flex;
padding: 15vh;
`;
const DownArrow = styled.img`
margin-top: 20px;
height: 40px;
animation: animateDown infinte 1.5s;
`;
const Buttons = styled.div``;
App.css
* {
box-sizing: border-box;
font-family: "Rubik", sans-serif;
color: #393c41;
margin: 0;
padding: 0;
}
body {
width: 100%;
}
#keyframes animateDown {
0%,
20%,
50%,
80%,
100% {
transform: translateY(0);
}
40% {
transform: translateY(5px);
}
60% {
transform: translateY(3px);
}
}
Check Arrow Down Component I added a Animation on that.
I checked in Chrome it tell in valid property value on webkit I colud not find the Solution
I needed your Help guys
Thanks in Advance <3

My deployed website is distorted on iphones but looks correct on desktop and non-iphone phones. All help is much appreciated

[W O R K I N G ]
Here is how it looks on my desktop (https://imgur.com/A5TpUu2)
My friend's phone which isn't an iphone (https://imgur.com/V0Khmjq)
Iphone 11 according to browser (https://i.imgur.com/MjZyxih.png)
[N O T - W O R K I NG]
A screenshot from an iphone 11 (https://imgur.com/YV5qHuV)
A screenshot from an iphone 12 (https://imgur.com/ltZo7xQ)
[SASS FOR NAVIGATION]
.navigationBar_ul--desktop{
display: none;
}
.navigationBar{
background-color: white;
height: fit-content;
display: flex;
justify-content: flex-end;
position:sticky;
top: 0;
overflow: hidden;
z-index: 5;
}
.navigationBar.active {
background-color: #F5F5F5;
}
.app_navbar-menu {
width: fit-content;
height: fit-content;
.app_navbar-menu_icon{
color: rgba(0, 0, 0, 0.799);
height: clamp(2rem, 4rem, 6rem);
margin-right: 1rem;
}
div {
position: fixed;
top: 0;
bottom: 0;
right: 0;
z-index: 50;
padding: 1rem;
width: 80%;
height: 100vh;
display: flex;
justify-content: flex-end;
align-items: flex-end;
flex-direction: column;
box-shadow: 0 0 50px rgba(7, 7, 7, 0.5);
background: white;
overflow: hidden;
-webkit-backface-visibility: hidden;
svg {
width: 15%;
height: auto;
color: rgba(252,98,77);
}
ul {
list-style: none;
margin: 0;
padding: 0;
height: 100%;
width: 100%;
display: flex;
gap: 10%;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
li {
height: fit-content;
cursor: pointer;
a{
text-decoration: none;
font-size: 2rem;
font-weight: 500;
text-transform: uppercase;
font-family: 'Montserrat', sans-serif;
color: black;
transition: all .3s ease-in-out;
}
}
}
}
}
}
[SASS FOR HOME BACKGROUND]
padding-top: 4rem;
padding-bottom: 4rem;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
background: linear-gradient( rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0) ), url('./homeImage.png');
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size : cover;```
I think there could be different solutions. One would be to declare the whole header as a flexbox and set the button to the right side with margin-left: auto;. You also could just care about the CSS for an iPhone with specific CSS rules, for example:
#supports (-webkit-touch-callout: none) {
/* CSS specific to iOS devices */
}
#supports not (-webkit-touch-callout: none) {
/* CSS for other than iOS devices */
}

How do I limit characters and then unlimit then on hover using css scale?

So, I have a roundish card that my client don't want to get rid off, but the dynamic text will always be larger than the card itself. I have to limit the characters at first and then show the full text on hover and he want's me to zoom in the card so it can be larger to fit the text. How do I do that? I've been trying scale and width with ch, but on hover I cannot change the width since it only zooms in.
I'm using Angular 9, Typescript and Scss.
.model-list {
display: flex;
width: 65rem;
height: 55vh;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
justify-content: center;
overflow-y: scroll;
scrollbar-width: none;
.model-card {
display: flex;
flex-direction: row;
align-items: center;
margin: 10px 20px;
padding: 10px;
width: 16rem;
height: 5rem;
border-radius: 50px;
-webkit-box-shadow: 0px 1px 20px -4px rgba(0, 0, 0, 0.27);
box-shadow: 0px 1px 20px -4px rgba(0, 0, 0, 0.27);
cursor: pointer;
.text {
width: 13rem;
display: flex;
flex-direction: column;
padding: 16px;
.name {
font-size: 15px;
font-weight: bold;
color: #626c75;
margin: 0px;
width: 100%;
}
.description {
display: flex;
flex-direction: row;
font-size: 14px;
color: #dce1e7;
margin: 0px;
width: 17ch;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.icon-container {
width: 5rem;
height: 5rem;
img {
width: 100%;
height: 100%;
}
}
&:hover,
&.active {
transform: scale(1.2);
.name,
.description {
width: 60ch;
color: white;
}
}
}
}

Struggling to navigate styling on React

I'm extremely new to this stuff, so please don't judge.
I'm trying to build a website and now I'm at the css part of it. My text is showing up in a different color than what I chose, its in the middle and its supposed to be on the left, I added a Menu icon but that's nowhere to be seen and I've added sections in the menu, also nothing.
I feel like crying.
I'm following an instructional and the code is exactly the same, but its showing up different on my side.
import styled from 'styled-components'
import {Link as LinkR} from 'react-router-dom'
import { findByLabelText } from '#testing-library/dom';
import {Link as LinkS} from 'react-scroll'
export const Nav = styled.nav`
background: #000;
height: 80px;
/*margin-top: -80px; */
display: flex;
justify-content: center;
align-items: center;
font-size: 1rem;
position: sticky;
top: 0;
z-index: 1;
#media screen and (max-width: 960px) {
transition: 0.8s all ease;
}
`
export const NavbarContainer = styled.div`
display: flex;
justify-content: space-between;
height: 80px;
z-index: 1'
width: 100%;
padding: 0 24px;
max-width: 1100px;
`
export const NavLogo = styled(LinkR)`
color: red;
justify-self: flex-start;
cursor: pointer;
font-size: 1.5rem;
display: flex;
align-items: center;
margin-left: 24px;
font-weight: bold;
text-decoration: none;
`;
export const MobileIcon = styled.div`
display:none;
#media screen and (max-width: 768px) {
display: block;
position: absolute;
top: o;
right: 0;
transfrom: translate(-100%, 60%);
font-size: 1.8rem;
cursor: pointer;
color: #000;
}
`
export const NavMenu = styled.ul`
display: flex;
align-itens: center;
list-style: none;
text-align: center;
margin-right: -22px;
#media screen and (max-width: 768px) {
display: none;
}
`
export const NavItem = styled.li`
height: 80px;
`
export const NavLinks = styled (LinkS)`
color: #fff;
display: flex;
align-items: center;
text-decoration: none;
padding: 0 1rem;
height: 100%;
cursor: pointer;
&.active {
border-bottom: 3px solid #01bf71;
}
`
I don't know if it solves your problem, but:
In your code at the NavbarContainer after you set the z-index you have a quote instead of a semicolon.
And also at the NavMenu you wrote align-itens instead of align-items.
If you are using VSCode then install the following extension: vscode-styled-components

Div passing full width of parent div

Hello I have a daughter div that is passing the full width of the parent div for some reason I still can't find the solution:
like this:
for some reason instead of skipping paragraph it is always horizontal I've tried everything and found no solution.
code:
<Styled.ChatBox>
<Styled.ChatLog>
<Styled.MessageWrapper user={true}>
<Styled.ChatMessage user={true}>{props.children}</Styled.ChatMessage>
</Styled.MessageWrapper>
</Styled.ChatLog>
</Styled.ChatBox>
css:
const messageBot = css`
align-self: flex-start;
background-color: #e0e0e0;
color: black;
border-radius: 8px;
padding: 10px 10px 10px 15px;
font-size: 15px;
font-family: sans-serif;
`;
const messageClient = css`
align-self: flex-end;
background-color: #1a6fe8;
color: white;
border-radius: 8px;
padding: 10px 10px 10px 15px;
font-size: 15px;
font-family: sans-serif;
`;
const ChatBox = styled.div`
display: ${props => (props.widget ? 'none' : 'flex')};
position: absolute;
position: fixed;
right: 20px;
bottom: 20px;
flex-direction: column;
max-width: 22em;
width: 100%;
height: 30em;
border-radius: 6px;
box-shadow: rgba(0, 0, 0, 0.5) 0px 0px 10px 2px;
background: ${props => (props.widget ? 'red' : 'blue')};
`;
const ChatLog = styled.div`
display: flex;
flex-direction: column;
max-height: 400px;
width: 100%;
overflow-y: auto;
flex: 1 100%;
background: red;
padding: 10px 10px 0px 10px;
box-sizing: border-box;
`;
const MessageWrapper = styled.div`
background: yellow;
display: flex;
align-items: center;
flex-direction: row;
box-sizing: border-box;
width: 100%;
justify-content: ${props => (props.user ? 'flex-end' : 'flex-start')};
`;
const ChatMessage = styled.div`
position: relative;
margin: 1ex;
padding: 1ex;
border-radius: 2px;
:before {
content: '';
position: absolute;
top: 50%;
right: ${props => (props.user ? '-5px' : '')};
left: ${props => (props.user ? '' : '1px')};
height: 15px;
width: 15px;
background: ${props => (props.user ? '#1a6fe8' : '#e0e0e0')};
transform: rotate(45deg);
transform-origin: top right;
}
${props => (props.user ? messageClient : messageBot)}
`;
I know that my div that is passing the size is ChatMessage
I believe she is the problem
img:
example on:
https://codesandbox.io/s/cool-water-1dwqx
You need to handle the overflow of the element.
const ChatMessage = styled.div`
...
overflow: hidden;
word-break: break-all;
`;

Resources