Skip to content

Commit

Permalink
Correctly applied styles to Figure component in docs (#6894)
Browse files Browse the repository at this point in the history
It turns out the styles that we had in `style.modules.css` were
overridden by browser defaults.

## Before


![image](https://github.com/Unleash/unleash/assets/107407814/c43dee92-c055-4e16-a632-c462dbf3ed59)


## After


![image](https://github.com/Unleash/unleash/assets/107407814/de84166a-8798-4be7-8639-6cae042fc89f)


Now taking into account all the styles that were in the CSS files
(notice margin and border)
  • Loading branch information
alvinometric committed Apr 19, 2024
1 parent 2cb9cea commit a71d794
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions website/src/components/Figure/Figure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@
// biome-ignore lint/style/useImportType: <explanation>
import React from 'react';
import useBaseUrl from '@docusaurus/useBaseUrl';

import './styles.module.css';
import styles from './styles.module.css';

type Props = {
// An optional alt text, if the caption does not already convey all relevant
Expand All @@ -81,7 +80,7 @@ type Props = {

const Component: React.FC<Props> = ({ img, alt, caption }) => {
return (
<figure>
<figure className={styles.figure}>
<img alt={alt} src={useBaseUrl(img)} />
<figcaption>{caption}</figcaption>
</figure>
Expand Down
8 changes: 4 additions & 4 deletions website/src/components/Figure/styles.module.css
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/* Figures (with captions) */
.main-wrapper figure {
.figure {
box-shadow: var(--ifm-global-shadow-lw);
border-radius: var(--ifm-global-radius);
border: var(--ifm-global-border-width) solid var(--unleash-color-gray);
padding: var(--ifm-pre-padding);
margin-inline: 0;
}

figure img {
.figure img {
box-shadow: none;
border: none;
}

figure * + * {
.figure * + * {
margin-block-start: var(--ifm-pre-padding);
}

figcaption {
.figure figcaption {
font-size: var(--unleash-font-size-smaller);
padding-inline: var(--ifm-pre-padding);
border-inline-start: 5px solid var(--ifm-color-primary);
Expand Down

0 comments on commit a71d794

Please sign in to comment.