-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from mckn/mckn/compatability-update
Bugfix: keeping backwards compatability when using new Stack component.
- Loading branch information
Showing
3 changed files
with
30 additions
and
6 deletions.
There are no files selected for viewing
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,22 @@ | ||
import React, { PropsWithChildren } from 'react'; | ||
import { Stack, HorizontalGroup } from '@grafana/ui'; | ||
|
||
// This component is used to keep backwards compatability | ||
// for older Grafana versions that doesn't have the Stack | ||
// component. | ||
export function Center({ children }: PropsWithChildren) { | ||
if (typeof Stack !== 'undefined') { | ||
return ( | ||
<Stack justifyContent="center" alignItems="center"> | ||
{children} | ||
</Stack> | ||
); | ||
} | ||
|
||
return ( | ||
// eslint-disable-next-line deprecation/deprecation | ||
<HorizontalGroup justify="center" align="center"> | ||
{children} | ||
</HorizontalGroup> | ||
); | ||
} |
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