Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[comp: Typography] add component Typography #130

Closed
1 task done
LaamGinghong opened this issue Jan 11, 2021 · 12 comments · Fixed by #148
Closed
1 task done

[comp: Typography] add component Typography #130

LaamGinghong opened this issue Jan 11, 2021 · 12 comments · Fixed by #148
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@LaamGinghong
Copy link
Contributor

LaamGinghong commented Jan 11, 2021

  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

解决文章排布问题,对不同的标签提供各种不同的样式封装。

What does the proposed API look like?

ix-typoraphy 指令

全局指令,使用方式如下:

<template>
	<article ix-typoraphy>
    	<h1 ix-typoraphy="titleOptions">Title</h1>
        <p ix-typoraphy="paragraphOptions">In the process of internal desktop applications development, many different design specs and implementations would be involved, which might cause designers and developers difficulties and duplication and reduce the <span ix-typoraphy="textOptions">efficiency</span> of development.</p>
    </article>
</template>

<script>
	export default {
        data() {
       		 return {
                 titleOptions: {},
                 paragraphOptions: {},
                 textOptions: {}
             }    
        }
    }
</script>
options

标题、段落、文本的配置选项

名称 说明 类型 默认值 备注
code 添加代码样式 boolean false -
delete 添加删除线样式 boolean false -
disabled 添加禁用文本样式 boolean false -
mark 添加标记样式 boolean false -
strong 添加粗体样式 boolean false -
underline 添加下划线样式 boolean false -
type 文本类型 TyporaphyType - -
type TyporaphyType = 'secondary' | 'success' | 'warning' | 'danger'
@LaamGinghong LaamGinghong added the enhancement New feature or request label Jan 11, 2021
@LaamGinghong
Copy link
Contributor Author

@danranVm review

@danranVm danranVm added this to the v1.0.0 milestone Jan 11, 2021
@danranVm
Copy link
Member

建议参考 ng-zorro, 把 ix-typoraphy-text ix-typography-title ix-typography-paragraph 合并成一个组件。
不然用起来太麻烦了。

@danranVm
Copy link
Member

Copyable Editable Ellipsis 能否封装成指令?

@LaamGinghong
Copy link
Contributor Author

Copyable Editable Ellipsis 能否封装成指令?

指令好像不能限制对应组件使用吧,如果是那样的话每个组件都能使用这个指令?

@LaamGinghong
Copy link
Contributor Author

建议参考 ng-zorro, 把 ix-typoraphy-text ix-typography-title ix-typography-paragraph 合并成一个组件。
不然用起来太麻烦了。

不知道vue有没有指令型组件啊

@danranVm
Copy link
Member

Copyable Editable Ellipsis 能否封装成指令?

指令好像不能限制对应组件使用吧,如果是那样的话每个组件都能使用这个指令?

对,目的就是希望这样,例如:

<span v-copyable>text</span>
<div v-editable >text</span>

而不是一定要使用 typoraphy 组件

@danranVm
Copy link
Member

建议参考 ng-zorro, 把 ix-typoraphy-text ix-typography-title ix-typography-paragraph 合并成一个组件。
不然用起来太麻烦了。

不知道vue有没有指令型组件啊

vue 指令的功能比较弱,可能需要想其他办法。
我暂时想到的就是让用户指定 tag:

<ix-typoraphy tag="h1"> H1 Titile </ix-typoraphy>
<ix-typoraphy tag="p"> paragraph </ix-typoraphy>
<ix-typoraphy tag="code"> code </ix-typoraphy>

@hele10086
Copy link
Contributor

将这个组件进行一个拆分,把交互功能的 editor,copyable,ellipsis 这几个做成组件,而 typograph 自身作为一个纯粹的样式类的封装,并且通过指令的方式使用。

@LaamGinghong
Copy link
Contributor Author

@hele10086 @danranVm 请重新review

@danranVm
Copy link
Member

danranVm commented Jan 13, 2021

参考 ng-zorro: https://ng.ant.design/components/typography/zh#components-typography-demo-text

    <span nz-typography><mark>Ant Design (mark)</mark></span>
    <span nz-typography><code>Ant Design (code)</code></span>
    <span nz-typography><kbd>Ant Design (keyboard)</kbd></span>
    <span nz-typography><u>Ant Design (underline)</u></span>
    <span nz-typography><del>Ant Design (delete)</del></span>
    <span nz-typography><strong>Ant Design (strong)</strong></span>

似乎只需要两个 props 就可以了?默认为 type

  <span ix-typography="'success'">success</span>
  <span ix-typography="'danger'">danger</span>
  <span ix-typography="{type:'success', disabled: true}">success and disabled</span>

@LaamGinghong
Copy link
Contributor Author

参考 ng-zorro: https://ng.ant.design/components/typography/zh#components-typography-demo-text

    <span nz-typography><mark>Ant Design (mark)</mark></span>
    <span nz-typography><code>Ant Design (code)</code></span>
    <span nz-typography><kbd>Ant Design (keyboard)</kbd></span>
    <span nz-typography><u>Ant Design (underline)</u></span>
    <span nz-typography><del>Ant Design (delete)</del></span>
    <span nz-typography><strong>Ant Design (strong)</strong></span>

似乎只需要两个 props 就可以了?默认为 type

  <span ix-typography="'success'">success</span>
  <span ix-typography="'danger'">danger</span>
  <span ix-typography="{type:'success', disabled: true}">success and disabled</span>

那好像 type 就够用了,disabled 用 html 元素上面的 disabled

@danranVm
Copy link
Member

danranVm commented Jan 14, 2021

有些元素不支持 disabled ... 动态 disabled 的时候编译的结果不一致,button 组件做了一下处理。

<component :is="tag" class="ix-button" :class="classes" :disabled="disabled || loading ? true : undefined">

不然会这样子:

<button :disabled="disabled"> Button </button>
<a :disabled="disabled"> A </a>

编辑结果:

<!-- 当 `disabled` 为 false 的时候 -->
<button> Button </button>
<a disabled="false"> A </a>

<!-- 当 `disabled` 为 true 的时候 -->
<button disabled> Button </button>
<a disabled="true"> A </a>

<!-- 当 `disabled` 为 undefined 的时候 -->
<button> Button </button>
<a> A </a>

LaamGinghong added a commit to LaamGinghong/idux that referenced this issue Jan 18, 2021
LaamGinghong added a commit to LaamGinghong/idux that referenced this issue Jan 19, 2021
danranVm pushed a commit that referenced this issue Jan 20, 2021
* docs(comp: typography): modify docs

* feat(comp: typography): add type check

* feat(comp: typography): style

* test(comp: typography): add test

fix #130
CruellyJoHn pushed a commit to CruellyJoHn/components that referenced this issue Jan 22, 2021
fix IDuxFE#77

build: upgrade vite (IDuxFE#102)

refactor(comp:all): updalte all components ts definition (IDuxFE#103)

docs: update all components index.zh.md (IDuxFE#105)

* docs: update gen script

fix(comp: divider): dynamic slot (IDuxFE#104)

fix IDuxFE#76

feat(comp: spin): add spin component (IDuxFE#101)

fix IDuxFE#72

refactor(comp:core): useGlobalConfig (IDuxFE#107)

fix: vite traverse filename config (IDuxFE#106)

docs: update spin component demo (IDuxFE#109)

fix(comp: divider): slots rerender (IDuxFE#110)

refactor(comp:i18n): update useI18n to useLocale (IDuxFE#111)

feat(comp: space): add component space (IDuxFE#97)

fix IDuxFE#63

fix(comp:all): solot dynamic load (IDuxFE#114)

fix: add engines to package.json (IDuxFE#117)

yarn start error because of the low version of Node.js

fix IDuxFE#116

refactor: script gen type structure (IDuxFE#118)

refactor: script gen types template (IDuxFE#119)

* Update the template to make it more simpler.

style(scripts): add brace style eslint rule (IDuxFE#123)

fix IDuxFE#122

refactor(comp:all): export type declaration from current component (IDuxFE#124)

docs: contribution (IDuxFE#125)

update contributing.zh and add contributing.en

fix(comp: image): export type to fix vite error (IDuxFE#127)

feat(cdk:forms): add useFormControl and Validtors (IDuxFE#121)

* test(cdk:forms): add test

fix IDuxFE#115

docs(cdk:forms): add validators docs (IDuxFE#128)

re IDuxFE#115

docs: modify components' docs' type (IDuxFE#131)

feat(comp: empty): add component empty (IDuxFE#132)

* feat(comp:empty): update and add test

fix IDuxFE#54

feat(cdk:utils): add hasOwnProperty function (IDuxFE#137)

fix(comp: badge): overflowCount not work (IDuxFE#135)

fix IDuxFE#134

test(comp:badge,icon): fix warning (IDuxFE#140)

feat(comp: result): add result component (IDuxFE#136)

fix IDuxFE#112

feat(cdk:forms): add formGroup and formArray (IDuxFE#139)

* feat(cdk:forms): add test

re IDuxFE#115

feat(cdk:forms): add utils (IDuxFE#141)

re IDuxFE#115

refactor(cdk:forms): `modelRef` renamed to `valueRef` (IDuxFE#142)

re IDuxFE#115

feat(cdk:forms): add watchValue and watchStatus (IDuxFE#143)

re IDuxFE#115

refactor(cdk:forms): add dirty status and marks `valueRef` to readonly (IDuxFE#144)

re IDuxFE#115

feat(cdk:forms): setValue support configuration options (IDuxFE#146)

re IDuxFE#115

feat: add global types (IDuxFE#150)

docs(cdk:forms): add docs and demo (IDuxFE#149)

fix IDuxFE#115

refactor(cdk:forms): update typescript defintions (IDuxFE#151)

* docs(cdk:forms): update docs

feat(cdk: subject): add subject (IDuxFE#155)

fix IDuxFE#154

feat(comp: typography): add directive typography (IDuxFE#148)

* docs(comp: typography): modify docs

* feat(comp: typography): add type check

* feat(comp: typography): style

* test(comp: typography): add test

fix IDuxFE#130

feature(comp:card): 1.修改dom结构 2.补全css样式 3.重跑单测

feat(comp:card): 1.解决合并冲突

feat(comp:card): add card component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants