generated from arvinxx/npm-template
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
303 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* compact: true | ||
* title: 响应式断点 | ||
* description: 不同断点下,背景色和文本内容不同 | ||
*/ | ||
import { createStyles, useResponsive } from 'antd-style'; | ||
|
||
const useStyles = createStyles(({ css, responsive }) => ({ | ||
container: css` | ||
height: 100px; | ||
display: flex; | ||
font-size: 24px; | ||
align-items: center; | ||
justify-content: center; | ||
background-color: lightskyblue; | ||
color: darkblue; | ||
${responsive.tablet} { | ||
background: darkseagreen; | ||
color: darkgreen; | ||
} | ||
${responsive.desktop} { | ||
background: darksalmon; | ||
color: saddlebrown; | ||
} | ||
${responsive.mobile} { | ||
background: pink; | ||
color: deeppink; | ||
} | ||
`, | ||
})); | ||
|
||
const App = () => { | ||
const { styles } = useStyles(); | ||
|
||
const { laptop, desktop, mobile } = useResponsive(); | ||
return ( | ||
<div className={styles.container}> | ||
{mobile ? 'mobile' : desktop ? 'desktop' : laptop ? 'laptop' : 'tablet'} | ||
</div> | ||
); | ||
}; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* inherit: true | ||
* defaultShowCode: true | ||
*/ | ||
import { SmileOutlined } from '@ant-design/icons'; | ||
import { Button, Space } from 'antd'; | ||
import { createStyles } from 'antd-style'; | ||
|
||
const useStyles = createStyles(({ token, css, cx }) => { | ||
const commonCard = css` | ||
border-radius: ${token.borderRadiusLG}px; | ||
padding: ${token.paddingLG}px; | ||
`; | ||
|
||
return { | ||
container: css` | ||
background-color: ${token.colorBgLayout}; | ||
padding: 24px; | ||
`, | ||
|
||
defaultCard: css` | ||
${commonCard}; | ||
background: ${token.colorBgContainer}; | ||
color: ${token.colorText}; | ||
`, | ||
|
||
primaryCard: cx( | ||
commonCard, | ||
css` | ||
background: ${token.colorPrimary}; | ||
color: ${token.colorTextLightSolid}; | ||
`, | ||
), | ||
}; | ||
}); | ||
|
||
const App = () => { | ||
const { styles } = useStyles(); | ||
|
||
return ( | ||
<div className={styles.container}> | ||
<Space direction={'vertical'} style={{ width: '100%' }} size={16}> | ||
<Space> | ||
<Button title={'功能按钮的说明'} icon={<SmileOutlined />} /> | ||
操作按钮 | ||
</Space> | ||
<div className={styles.defaultCard}>普通卡片</div> | ||
<div className={styles.primaryCard}>主要卡片</div> | ||
</Space> | ||
</div> | ||
); | ||
}; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters