Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
ik_invoicing
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_frontend
ik_invoicing
Commits
a22ead52
Commit
a22ead52
authored
Jan 11, 2017
by
小明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重构 components 下 Text 组件代码
parent
428f0ce1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
0 deletions
+57
-0
src/components/Text/index.js
+46
-0
src/components/Text/tests/index.test.js
+11
-0
No files found.
src/components/Text/index.js
0 → 100644
View file @
a22ead52
/**
*
* IKText
*
*/
import
React
,
{
PureComponent
}
from
'react'
;
class
IKText
extends
PureComponent
{
// eslint-disable-line react/prefer-stateless-function
static
propTypes
=
{
label
:
React
.
PropTypes
.
string
,
text
:
React
.
PropTypes
.
string
,
button
:
React
.
PropTypes
.
string
,
buttonEvent
:
React
.
PropTypes
.
func
,
};
constructor
(
props
)
{
super
(
props
);
}
render
()
{
const
props
=
$
({},
this
.
props
);
let
svgElm
=
null
;
if
(
props
.
button
)
{
props
.
style
=
{
width
:
'80%'
};
svgElm
=
(
<
svg
>
<
use
xlinkHref
=
{
props
.
button
}
onClick
=
{
props
.
buttonEvent
}
/
>
<
/svg
>
);
}
return
(
<
div
className
=
"ikmd-text"
>
<
label
className
=
'shrunken'
>
{
props
.
label
}
<
/label
>
<
span
>
{
props
.
text
}
<
/span
>
{
svgElm
}
<
/div
>
);
}
}
export
default
IKText
;
src/components/Text/tests/index.test.js
0 → 100644
View file @
a22ead52
// import IKText from '../index';
import
expect
from
'expect'
;
// import { shallow } from 'enzyme';
// import React from 'react';
describe
(
'<IKText />'
,
()
=>
{
it
(
'Expect to have unit tests specified'
,
()
=>
{
expect
(
true
).
toEqual
(
false
);
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment