-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #781 from GuYith/master
feat: improve link component, add docs and examples
- Loading branch information
Showing
16 changed files
with
428 additions
and
186 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,13 @@ | ||
import { h, tag, WeElement } from 'omi' | ||
|
||
import '../index' | ||
|
||
@tag('link-base') | ||
export default class LinkBase extends WeElement { | ||
static css = `t-link { | ||
margin: 5px 5px; | ||
}` | ||
render() { | ||
return <t-link theme="primary">跳转链接</t-link> | ||
} | ||
} |
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,35 @@ | ||
import { h, tag, WeElement } from 'omi' | ||
|
||
import '../index' | ||
|
||
@tag('link-disabled') | ||
export default class LinkDisabled extends WeElement { | ||
static css = `t-link { | ||
margin: 5px 5px; | ||
}` | ||
clickLink = () => { | ||
console.log('不触发') | ||
} | ||
render() { | ||
return ( | ||
<div> | ||
<t-link theme="default" disabled onClick={this.clickLink}> | ||
查看链接 | ||
</t-link> | ||
<t-link theme="primary" underline disabled onClick={this.clickLink}> | ||
查看链接 | ||
</t-link> | ||
<t-link theme="danger" hover="color" disabled onClick={this.clickLink}> | ||
查看链接 | ||
</t-link> | ||
<t-link theme="warning" hover="underline" disabled onClick={this.clickLink}> | ||
查看链接 | ||
</t-link> | ||
{/* TODO: stuck by Icon, need add suffixIcon={<JumpIcon />} */} | ||
<t-link theme="success" disabled onClick={this.clickLink}> | ||
查看链接 | ||
</t-link> | ||
</div> | ||
) | ||
} | ||
} |
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,67 @@ | ||
import { h, tag, WeElement } from 'omi' | ||
|
||
import '../index' | ||
|
||
@tag('link-hover') | ||
export default class LinkHover extends WeElement { | ||
static css = `t-link { | ||
margin: 5px 5px; | ||
}` | ||
render() { | ||
return ( | ||
<div direction="vertical"> | ||
<div> | ||
<t-link theme="default" hover="underline"> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="primary" hover="underline"> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="danger" hover="underline"> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="warning" hover="underline"> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="success" hover="underline"> | ||
跳转链接 | ||
</t-link> | ||
</div> | ||
<div> | ||
<t-link theme="default" hover="color"> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="primary" hover="color"> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="danger" hover="color"> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="warning" hover="color"> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="success" hover="color"> | ||
跳转链接 | ||
</t-link> | ||
</div> | ||
<div> | ||
<t-link theme="default" hover="color" underline> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="primary" hover="color" underline> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="danger" hover="color" underline> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="warning" hover="color" underline> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="success" hover="color" underline> | ||
跳转链接 | ||
</t-link> | ||
</div> | ||
</div> | ||
) | ||
} | ||
} |
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,27 @@ | ||
import { h, tag, WeElement } from 'omi' | ||
|
||
import '../index' | ||
|
||
@tag('link-icon') | ||
export default class LinkIcon extends WeElement { | ||
static css = `t-link { | ||
margin: 5px 5px; | ||
}` | ||
render() { | ||
return ( | ||
// TODO: stuck by icon, need to add prefixIcon | ||
<div> | ||
<t-link theme="default">跳转链接</t-link> | ||
<t-link theme="primary" underline href="https://tdesign.tencent.com/" target="_self"> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="danger" underline href="https://tdesign.tencent.com/" target="_self"> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="warning" underline href="https://tdesign.tencent.com/" target="_self" disabled> | ||
跳转链接 | ||
</t-link> | ||
</div> | ||
) | ||
} | ||
} |
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,71 @@ | ||
import { h, tag, WeElement } from 'omi' | ||
|
||
import '../index' | ||
|
||
@tag('link-size') | ||
export default class LinkSize extends WeElement { | ||
static css = `t-link { | ||
margin: 5px 5px; | ||
}` | ||
clickLink = () => { | ||
console.log('不触发') | ||
} | ||
render() { | ||
return ( | ||
// TODO: stuck by Icon, need to add suffixIcon and Space | ||
<div direction="vertical"> | ||
<div> | ||
<t-link theme="default" size="small"> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="primary" size="small"> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="danger" size="small"> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="warning" size="small" disabled> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="success" size="small"> | ||
跳转链接 | ||
</t-link> | ||
</div> | ||
<div> | ||
<t-link theme="default" size="medium"> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="primary" size="medium"> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="danger" size="medium"> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="warning" size="medium" disabled> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="success" size="medium"> | ||
跳转链接 | ||
</t-link> | ||
</div> | ||
<div> | ||
<t-link theme="default" size="large"> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="primary" size="large"> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="danger" size="large"> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="warning" size="large" disabled> | ||
跳转链接 | ||
</t-link> | ||
<t-link theme="success" size="large"> | ||
跳转链接 | ||
</t-link> | ||
</div> | ||
</div> | ||
) | ||
} | ||
} |
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
Oops, something went wrong.