@chakra-ui/core#AlertDescription JavaScript Examples
The following examples show how to use
@chakra-ui/core#AlertDescription.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: error.js From space-rockets-challenge with MIT License | 6 votes |
export default function Error() {
return (
<Flex alignItems="center" justifyContent="center" width="100%">
<Alert
status="error"
variant="left-accent"
flexDirection="column"
justifyContent="center"
textAlign="center"
p="8"
>
<AlertIcon size="6" mr={0} />
<AlertTitle mt={4} mb={1} fontSize="lg">
Problems loading the data
</AlertTitle>
<AlertDescription maxWidth="md">
If the problem persists, try to refresh the page or wait a few minutes
and try again.
</AlertDescription>
</Alert>
</Flex>
);
}
Example #2
Source File: DashboardHome.js From allay-fe with MIT License | 4 votes |
DashboardHome = ({ data, getReview, history, isLoading }) => {
// search state
const [filteredReviews, setFilteredReviews] = useState([])
const [searchResults, setSearchResults] = useState([])
const [trackFilters, setTrackFilters] = useState([])
const [typeFilters, setTypeFilters] = useState([])
const isDeleted = useSelector((state) => state.review.reviewDeleted)
useEffect(() => {
getReview()
}, [isDeleted, getReview])
// filter searchbar by company name
useEffect(() => {
const results = data.filter((review) =>
review.company_name.toLowerCase().includes(searchResults)
)
// data = results;
setFilteredReviews(results)
}, [searchResults, data])
// filter by track and review type
useEffect(() => {
const filteredResults = data.filter((review) =>
trackFilters.length > 0 && typeFilters.length > 0
? trackFilters.includes(review.track_name) &&
typeFilters.includes(review.review_type)
: trackFilters.length > 0
? trackFilters.includes(review.track_name)
: typeFilters.includes(review.review_type)
)
setFilteredReviews(filteredResults)
}, [trackFilters, typeFilters, data])
return (
<>
<Flex w="100%" minH="100vh" justify="center" pt="4%">
<Flex
maxW="1440px"
w="100%"
direction="column"
wrap="wrap"
mb="3%"
mt="190px"
>
<NavBar
history={history}
isLoading={isLoading}
setSearchResults={setSearchResults}
trackFilters={trackFilters}
setTrackFilters={setTrackFilters}
typeFilters={typeFilters}
setTypeFilters={setTypeFilters}
/>
<Flex height="70%" wrap="wrap" justify="center" mt="90px">
{isLoading ? (
<Flex w="100%" h="100%" align="center">
<CustomSpinner />
</Flex>
) : filteredReviews.length >= 1 ? (
filteredReviews.map((review) => (
<ReviewCard
key={review.review_id}
review={review}
history={history}
/>
))
) : searchResults.length > 0 ||
trackFilters.length > 0 ||
typeFilters.length > 0 ? (
<Flex as="h3" w="100%" ml="6%" mt="5%" overflow="visible">
<Alert
status="info"
variant="subtle"
flexDirection="column"
justifyContent="center"
textAlign="center"
height="312px"
width="625px"
background="#F2F6FE"
borderRadius="12px"
mt="2%"
wrap="nowrap"
>
{/* <AlertIcon size='40px' mr={0} /> */}
<AlertDescription w="100%">
Sorry, no job reviews found.
</AlertDescription>
</Alert>
</Flex>
) : (
data.length > 0 &&
data.map((review) => (
<ReviewCard
key={review.review_id}
review={review}
history={history}
/>
))
)}
</Flex>
</Flex>
</Flex>
</>
)
}