Skip to content

Commit

Permalink
feat: allow max height to be overridden for readme plugin (AxisCommun…
Browse files Browse the repository at this point in the history
…ications#111)

* feat(readme): allow to override max height of the readme box

Signed-off-by: Katlinsky, Ilya <[email protected]>

* feat(changeset): added changeset to describe what was done

Signed-off-by: Katlinsky, Ilya <[email protected]>

* chore(style): removed redundant empty line

Signed-off-by: Katlinsky, Ilya <[email protected]>

* chore(style, api): update styling and generate api report

Signed-off-by: Katlinsky, Ilya <[email protected]>

* chore: removed maxHeight prop, use maxHeght as none when fullHeight variant is used

Signed-off-by: Katlinsky, Ilya <[email protected]>

---------

Signed-off-by: Katlinsky, Ilya <[email protected]>
Co-authored-by: Katlinsky, Ilya <[email protected]>
  • Loading branch information
ikatlinsky and ikatlinski authored Mar 28, 2024
1 parent 9456530 commit 603304b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/sharp-apricots-do.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@axis-backstage/plugin-readme': minor
---

Updated the max height in case of variant `fullHeight` to be `none` by default. That is needed to really occupy the full height of the container.
2 changes: 1 addition & 1 deletion plugins/readme/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { JSX as JSX_2 } from 'react';
import { RouteRef } from '@backstage/core-plugin-api';

// @public
export const ReadmeCard: ({ variant }: ReadmeCardProps) => JSX_2.Element;
export const ReadmeCard: (props: ReadmeCardProps) => JSX_2.Element;

// @public
export type ReadmeCardProps = {
Expand Down
9 changes: 6 additions & 3 deletions plugins/readme/src/components/ReadmeCard/ReadmeCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ export type ReadmeCardProps = {
variant?: InfoCardVariants;
};

export const ReadmeCard = ({ variant }: ReadmeCardProps) => {
export const ReadmeCard = (props: ReadmeCardProps) => {
const { variant = 'gridItem' } = props;
const maxHeight = variant === 'fullHeight' ? 'none' : '235px';

const [displayDialog, setDisplayDialog] = useState(false);

return (
<>
<InfoCard
title="README"
variant={variant || 'gridItem'}
variant={variant}
action={
variant !== 'fullHeight' ? (
<IconButton
Expand All @@ -39,7 +42,7 @@ export const ReadmeCard = ({ variant }: ReadmeCardProps) => {
}
>
<div style={{ overflow: 'auto' }}>
<Box maxHeight={variant !== 'fullHeight' ? 235 : 500}>
<Box maxHeight={maxHeight}>
<FetchComponent />
</Box>
</div>
Expand Down

0 comments on commit 603304b

Please sign in to comment.