coreui-free-react-admin-template
197 строк · 7.3 Кб
1import React from 'react'2import {3CButton,4CCard,5CCardBody,6CCardHeader,7CCardImage,8CCardText,9CCardTitle,10CCol,11CPlaceholder,12CRow,13} from '@coreui/react'14import { DocsExample } from 'src/components'15
16import ReactImg from 'src/assets/images/react.jpg'17
18const Placeholders = () => {19return (20<CRow>21<CCol xs={12}>22<CCard className="mb-4">23<CCardHeader>24<strong>React Placeholder</strong>25</CCardHeader>26<CCardBody>27<p className="text-body-secondary small">28In the example below, we take a typical card component and recreate it with29placeholders applied to create a "loading card". Size and proportions are the30same between the two.31</p>32<DocsExample href="components/placeholder">33<div className="d-flex justify-content-around p-3">34<CCard style={{ width: '18rem' }}>35<CCardImage orientation="top" src={ReactImg} />36<CCardBody>37<CCardTitle>Card title</CCardTitle>38<CCardText>39Some quick example text to build on the card title and make up the bulk of the40card's content.41</CCardText>42<CButton color="primary" href="#">43Go somewhere
44</CButton>45</CCardBody>46</CCard>47<CCard style={{ width: '18rem' }}>48<CCardImage49component="svg"50orientation="top"51width="100%"52height="162"53xmlns="http://www.w3.org/2000/svg"54role="img"55aria-label="Placeholder"56preserveAspectRatio="xMidYMid slice"57focusable="false"58>59<title>Placeholder</title>60<rect width="100%" height="100%" fill="#868e96"></rect>61</CCardImage>62<CCardBody>63<CPlaceholder component={CCardTitle} animation="glow" xs={7}>64<CPlaceholder xs={6} />65</CPlaceholder>66<CPlaceholder component={CCardText} animation="glow">67<CPlaceholder xs={7} />68<CPlaceholder xs={4} />69<CPlaceholder xs={4} />70<CPlaceholder xs={6} />71<CPlaceholder xs={8} />72</CPlaceholder>73<CPlaceholder74color="primary"75component={CButton}76disabled
77href="#"78tabIndex={-1}79xs={6}80></CPlaceholder>81</CCardBody>82</CCard>83</div>84</DocsExample>85</CCardBody>86</CCard>87<CCard className="mb-4">88<CCardHeader>89<strong>React Placeholder</strong>90</CCardHeader>91<CCardBody>92<p className="text-body-secondary small">93Create placeholders with the <code><CPlaceholder></code> component and a grid94column propx (e.g., <code>xs={6}</code>) to set the <code>width</code>. They can95replace the text inside an element or be added as a modifier class to an existing96component.97</p>98<DocsExample href="components/placeholder">99<p aria-hidden="true">100<CPlaceholder xs={6} />101</p>102<CPlaceholder103color="primary"104component={CButton}105aria-hidden="true"106disabled
107href="#"108tabIndex={-1}109xs={4}110></CPlaceholder>111</DocsExample>112</CCardBody>113</CCard>114<CCard className="mb-4">115<CCardHeader>116<strong>React Placeholder</strong> <small> Width</small>117</CCardHeader>118<CCardBody>119<p className="text-body-secondary small">120You can change the <code>width</code> through grid column classes, width utilities, or121inline styles.122</p>123<DocsExample href="components/placeholder#width">124<CPlaceholder xs={6} />125<CPlaceholder className="w-75" />126<CPlaceholder style={{ width: '30%' }} />127</DocsExample>128</CCardBody>129</CCard>130<CCard className="mb-4">131<CCardHeader>132<strong>React Placeholder</strong> <small> Color</small>133</CCardHeader>134<CCardBody>135<p className="text-body-secondary small">136By default, the <code><CPlaceholder></code> uses <code>currentColor</code>. This137can be overridden with a custom color or utility class.138</p>139<DocsExample href="components/placeholder#color">140<CPlaceholder xs={12} />141
142<CPlaceholder color="primary" xs={12} />143<CPlaceholder color="secondary" xs={12} />144<CPlaceholder color="success" xs={12} />145<CPlaceholder color="danger" xs={12} />146<CPlaceholder color="warning" xs={12} />147<CPlaceholder color="info" xs={12} />148<CPlaceholder color="light" xs={12} />149<CPlaceholder color="dark" xs={12} />150</DocsExample>151</CCardBody>152</CCard>153<CCard className="mb-4">154<CCardHeader>155<strong>React Placeholder</strong> <small> Sizing</small>156</CCardHeader>157<CCardBody>158<p className="text-body-secondary small">159The size of <code><CPlaceholder></code>s are based on the typographic style of160the parent element. Customize them with <code>size</code> prop: <code>lg</code>,{' '}161<code>sm</code>, or <code>xs</code>.162</p>163<DocsExample href="components/placeholder#sizing">164<CPlaceholder xs={12} size="lg" />165<CPlaceholder xs={12} />166<CPlaceholder xs={12} size="sm" />167<CPlaceholder xs={12} size="xs" />168</DocsExample>169</CCardBody>170</CCard>171<CCard className="mb-4">172<CCardHeader>173<strong>React Placeholder</strong> <small> Animation</small>174</CCardHeader>175<CCardBody>176<p className="text-body-secondary small">177Animate placeholders with <code>animation="glow"</code> or{' '}178<code>animation="wave"</code> to better convey the perception of something179being <em>actively</em> loaded.180</p>181<DocsExample href="components/placeholder#animation">182<CPlaceholder component="p" animation="glow">183<CPlaceholder xs={12} />184</CPlaceholder>185
186<CPlaceholder component="p" animation="wave">187<CPlaceholder xs={12} />188</CPlaceholder>189</DocsExample>190</CCardBody>191</CCard>192</CCol>193</CRow>194)195}
196
197export default Placeholders198