Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
cfbbab9b
Unverified
Commit
cfbbab9b
authored
Nov 03, 2020
by
Peter Holmberg
Committed by
GitHub
Nov 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Docs: Add docs for InfoBox component (#28705)
* add mdx * fixes after pr feedback
parent
cb1449e4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
21 deletions
+44
-21
packages/grafana-ui/src/components/InfoBox/InfoBox.mdx
+24
-0
packages/grafana-ui/src/components/InfoBox/InfoBox.story.tsx
+17
-16
packages/grafana-ui/src/components/InfoBox/InfoBox.tsx
+3
-5
No files found.
packages/grafana-ui/src/components/InfoBox/InfoBox.mdx
0 → 100644
View file @
cfbbab9b
import { Meta, Props } from '@storybook/addon-docs/blocks';
import { InfoBox } from './InfoBox';
<Meta title="MDX|InfoBox" component={InfoBox} />
# InfoBox
A component for displaying information in different levels of severity (Success, Warning, Error, Info).
### Example usage
This component can be found in the settings for various data sources.
```tsx
<InfoBox
title="Example info box"
severity='info'
url="http://url.to.some.documentation"
onDismiss={dissmisInfoBox}
/>
```
<Props of={InfoBox} />
packages/grafana-ui/src/components/InfoBox/InfoBox.story.tsx
View file @
cfbbab9b
import
React
from
'react'
;
import
{
number
}
from
'@storybook/addon-knobs'
;
import
{
InfoBox
,
FeatureInfoBox
}
from
'@grafana/ui'
;
import
{
number
,
select
,
text
}
from
'@storybook/addon-knobs'
;
import
{
FeatureState
}
from
'@grafana/data'
;
import
{
InfoBox
,
FeatureInfoBox
}
from
'@grafana/ui'
;
import
mdx
from
'./InfoBox.mdx'
;
export
default
{
title
:
'Layout/InfoBox'
,
component
:
InfoBox
,
decorators
:
[],
parameters
:
{
docs
:
{},
docs
:
{
page
:
mdx
,
},
},
};
const
getKnobs
=
()
=>
{
const
CONTAINER_GROUP
=
'Container options'
;
// ---
const
containerWidth
=
number
(
'Container width'
,
800
,
{
const
containerWidth
=
number
(
'Container width'
,
800
,
{
range
:
true
,
min
:
100
,
max
:
1500
,
step
:
100
,
},
CONTAINER_GROUP
);
});
const
title
=
text
(
'Title'
,
'User permission'
);
const
url
=
text
(
'Url'
,
'http://docs.grafana.org/features/datasources/mysql/'
);
const
severity
=
select
(
'Severity'
,
[
'success'
,
'warning'
,
'error'
,
'info'
],
'info'
);
return
{
containerWidth
};
return
{
containerWidth
,
severity
,
title
,
url
};
};
export
const
basic
=
()
=>
{
const
{
containerWidth
}
=
getKnobs
();
const
{
containerWidth
,
severity
,
title
,
url
}
=
getKnobs
();
return
(
<
div
style=
{
{
width
:
containerWidth
}
}
>
<
InfoBox
title=
"User Permission"
url=
{
'http://docs.grafana.org/features/datasources/mysql/'
}
title=
{
title
}
url=
{
url
}
severity=
{
severity
}
onDismiss=
{
()
=>
{
alert
(
'onDismiss clicked'
);
}
}
...
...
packages/grafana-ui/src/components/InfoBox/InfoBox.tsx
View file @
cfbbab9b
import
React
from
'react'
;
import
{
css
,
cx
}
from
'emotion'
;
import
{
GrafanaTheme
}
from
'@grafana/data'
;
import
{
stylesFactory
,
useTheme
}
from
'../../themes'
;
import
{
Icon
}
from
'../Icon/Icon'
;
import
{
IconButton
}
from
'../IconButton/IconButton'
;
import
{
HorizontalGroup
}
from
'../Layout/Layout'
;
import
{
AlertVariant
}
from
'../Alert/Alert'
;
import
panelArtDark
from
'./panelArt_dark.svg'
;
import
panelArtLight
from
'./panelArt_light.svg'
;
import
{
AlertVariant
}
from
'../Alert/Alert
'
;
import
{
stylesFactory
,
useTheme
}
from
'../../themes
'
;
import
{
getColorsFromSeverity
}
from
'../../utils/colors'
;
export
interface
InfoBoxProps
extends
Omit
<
React
.
HTMLAttributes
<
HTMLDivElement
>
,
'title'
>
{
...
...
@@ -27,9 +27,7 @@ export interface InfoBoxProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
}
/**
* This is a simple InfoBox component, the api is not considered stable yet and will likely see breaking changes
* in future minor releases.
* @Alpha
@public
*/
export
const
InfoBox
=
React
.
memo
(
React
.
forwardRef
<
HTMLDivElement
,
InfoBoxProps
>
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment