-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Style
qiskit-card
directive with Furo (#426)
Part of #327. We use the same general design as Pytorch, but with several improvements: * The image stays a fixed size so that the aspect ratio is respected better and it doesn't constantly shrink and expand. * Uses flexbox rather than media queries. This results in a much smoother experience when resizing the screen. * Gets rid of a weird black overlay we were putting over the image. Instead, now we set opacity to 0.7 when not highlighted. * Adds a border so that there is a more distinct flat design. Pytorch design: ![pytorch-cards](https://github.com/Qiskit/qiskit_sphinx_theme/assets/14852634/9682efc1-664e-40bd-91c6-f49b06005188)
- Loading branch information
1 parent
972bd8f
commit 86535e3
Showing
6 changed files
with
91 additions
and
7 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
src/qiskit_sphinx_theme/assets/styles/_custom-directives.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// ------------------------------------------------------------------------------- | ||
// qiskit-card | ||
// ------------------------------------------------------------------------------- | ||
|
||
.qiskit-card { | ||
position: relative; // Needed for `.qiskit-card::after`. | ||
display: flex; | ||
justify-content: space-between; | ||
height: 12rem; | ||
margin-bottom: 1.875rem; | ||
|
||
border: 1px solid var(--color-table-border); | ||
background-color: var(--color-sidebar-background); | ||
cursor: pointer; | ||
|
||
p { | ||
color: var(--color-sidebar-link-text); | ||
} | ||
|
||
// This creates a purple border at the bottom. We set the width to 0, but to 100% on hover, so | ||
// that it transitions in. | ||
&::after { | ||
content: ""; | ||
display: block; | ||
position: absolute; | ||
width: 0; | ||
height: 1px; | ||
bottom: 0; | ||
left: 0; | ||
background-color: var(--qiskit-color-purple); | ||
transition: width .250s ease-in-out; | ||
} | ||
|
||
&:hover { | ||
background-color: unset; | ||
border-bottom: none; | ||
|
||
p { | ||
color: unset; | ||
} | ||
|
||
&::after { | ||
width: 100%; | ||
} | ||
|
||
.qiskit-card-image-container { | ||
opacity: unset; | ||
} | ||
} | ||
} | ||
|
||
.qiskit-card-text-container { | ||
flex-grow: 1; | ||
min-width: 0; | ||
padding: 1rem; | ||
} | ||
|
||
.qiskit-card-image-container { | ||
flex-shrink: 0; | ||
height: 100%; | ||
width: 20rem; // We use a fixed width so the image doesn't keep resizing. | ||
|
||
opacity: 0.7; | ||
|
||
// Float the image to the right of the container. | ||
display: flex; | ||
align-items: center; | ||
justify-content: flex-end; | ||
|
||
img { | ||
max-height: 100%; | ||
max-width: 100%; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.