Skip to content

Commit

Permalink
Merge pull request #119 from grafana/ash/remove-default-props
Browse files Browse the repository at this point in the history
Chore: Replace `defaultProps` usage
  • Loading branch information
ashharrison90 authored May 14, 2024
2 parents 4b34ad6 + 093c1d6 commit dd57d94
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Change Log

All notable changes to this project will be documented in this file.
## v1.7.11

- Replace usage of React's deprecated `defaultProps`
## v1.7.10

- Tweaks in type definitions for the `SQLEditor` component on the `blur` method
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@grafana/experimental",
"version": "1.7.10",
"version": "1.7.11",
"description": "Experimental Grafana components and APIs",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
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

0 comments on commit dd57d94

Please sign in to comment.