Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

141
Views
¿Cómo cambiar la propiedad de otros componentes con componentes con estilo?

Estoy usando styled-components y estoy tratando de cambiar la altura de Top a 300px cuando me enfoco en mi Input .

Intenté algo como esto pero no funcionó:

 &:focus ${Top} { height: 500px; }

Estructura del edificio:

 <Top> <Avatar src="./assets/person/1.jpeg" alt="" sx={{ width: "50px", height: "50px" }} /> <Input placeholder="What's in your mind?" /> </Top>

Mi código:

 export const Top = styled.div` display: flex; align-items: flex-start; height: 150px; `; export const Input = styled.textarea` flex: 1; height: 100%; resize: none; border: none; outline: none; font-size: 16px; padding: 10px; &:focus ${Top} { height: 500px; } `;

¿Cómo cambio el accesorio de otros componentes con componentes con estilo?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Use el selector ~ :

 export const Top = styled.div` display: flex; align-items: flex-start; height: 150px; `; export const Input = styled.textarea` flex: 1; height: 100%; resize: none; border: none; outline: none; font-size: 16px; padding: 10px; &:focus ~ ${Top} { height: 500px; } `;

¿Cuál es tu estructura dom?

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!