Giter Site home page Giter Site logo

Comments (3)

Oli8 avatar Oli8 commented on June 22, 2024

Hey,

You could use title and subTitle slots instead of props:

<Card {image} imageAlt="{name}'s pic" width="15.5em">
  <span slot="title" class="text-warning">
    {name}
  </span>
  <span slot="subTitle" class="text-danger">
    {description}
  </span>
  Card Content
</Card>

Then either use color utilities classes or add a selector and use regular css.

from spaper.

ABansal11 avatar ABansal11 commented on June 22, 2024

Hey @Oli8 ,

That worked great! I had one other related question: How would I go about doing the same thing with the width of the card?

For context, I am trying to optimize the website for mobile, so I would like to ideally use a media query to change the width of the card at a given screen size. However, I was not sure how I could do that for the card component.

Also, I would like the image to automatically scale to the card's width while maintaining its aspect ratio.

Thank you for your help!

from spaper.

Oli8 avatar Oli8 commented on June 22, 2024

You should probably use papercss grid, we should soon have components for that matter in spaper but you can still use it via good old HTML.

<div class="row">
  {#each ... }
    <div class="col lg-3 md-6 sm-12">
      <Card ... >...</Card>
    </div>
  {/each }
</div>

This will get you four cards on a row in "large" screens, two in "medium" screens and one in "small".

Regarding the image size, I don't have a good solution on the top of my head, maybe something with max-height/width or something more complex with javascript watching images dimension and resizing them.

from spaper.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.