Skip to content

Commit 366a472

Browse files
committed
create and export RiEmptyPrompt component
1 parent 5667ac2 commit 366a472

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import React, { HTMLAttributes } from 'react'
2+
import styled from 'styled-components'
3+
4+
interface RiEmptyPromptProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
5+
body?: React.ReactNode
6+
title?: React.ReactNode
7+
icon?: React.ReactNode
8+
}
9+
10+
const StyledEmptyPrompt = styled.div`
11+
max-width: 36em;
12+
text-align: center;
13+
padding: 24px;
14+
margin: auto;
15+
`
16+
17+
const Spacer = styled.div`
18+
height: ${({ theme }) => theme.core.space.space100};
19+
`
20+
21+
const RiEmptyPrompt = ({ body, title, icon }: RiEmptyPromptProps) => (
22+
<StyledEmptyPrompt>
23+
{icon}
24+
{title && (
25+
<>
26+
<Spacer />
27+
{title}
28+
</>
29+
)}
30+
{body && (
31+
<>
32+
<Spacer />
33+
{body}
34+
</>
35+
)}
36+
</StyledEmptyPrompt>
37+
)
38+
39+
export default RiEmptyPrompt

redisinsight/ui/src/components/base/layout/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import LoadingContent from './loading-content/LoadingContent'
33
import ResizableContainer from './resize/container/ResizableContainer'
44
import ResizablePanel from './resize/panel/ResizablePanel'
55
import ResizablePanelHandle from './resize/handle/ResizablePanelHandle'
6-
6+
import RiEmptyPrompt from './empty-prompt/RiEmptyPrompt'
77

88
export * from './card'
99
export * from './horizontal-spacer'
@@ -14,4 +14,5 @@ export {
1414
ResizablePanel,
1515
ResizableContainer,
1616
ResizablePanelHandle,
17+
RiEmptyPrompt,
1718
}

0 commit comments

Comments
 (0)