Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Chore: Replace defaultProps usage #119

Merged
merged 4 commits into from
May 14, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/QueryEditor/Space.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@ export interface SpaceProps {
/**
* @deprecated use the Space component from @grafana/ui instead. Available starting from @grafana/[email protected]
*/
export const Space = (props: SpaceProps) => {
const styles = useStyles2(useCallback((theme) => getStyles(theme, props), [props]));
export const Space = ({
v = 0,
h = 0,
layout = 'block',
}: SpaceProps) => {
const styles = useStyles2(useCallback((theme) => getStyles(theme, {
v,
h,
layout,
}), [v, h, layout]));

return <span className={cx(styles.wrapper)} />;
};

Space.defaultProps = {
v: 0,
h: 0,
layout: 'block',
};

const getStyles = (theme: GrafanaTheme2, props: SpaceProps) => ({
wrapper: css([
{
Expand Down
Loading