Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
36804759
Commit
36804759
authored
4 years ago
by
Loïc Correnson
Committed by
David Bühler
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[dome] typescript labels
parent
df41c616
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ivette/src/dome/src/renderer/controls/labels.js
+0
-102
0 additions, 102 deletions
ivette/src/dome/src/renderer/controls/labels.js
ivette/src/dome/src/renderer/controls/labels.tsx
+81
-0
81 additions, 0 deletions
ivette/src/dome/src/renderer/controls/labels.tsx
with
81 additions
and
102 deletions
ivette/src/dome/src/renderer/controls/labels.js
deleted
100644 → 0
+
0
−
102
View file @
df41c616
// --------------------------------------------------------------------------
// --- Labels
// --------------------------------------------------------------------------
/**
@packageDocumentation
@module dome/controls/labels
*/
import
React
from
'
react
'
;
import
{
Icon
}
from
'
./icons
'
;
import
'
./style.css
'
;
// --------------------------------------------------------------------------
// --- Generic Label
// --------------------------------------------------------------------------
const
addClass
=
(
a
,
b
)
=>
b
?
a
+
'
'
+
b
:
a
;
const
makeLabel
=
(
className
,
props
)
=>
{
const
{
display
=
true
}
=
props
;
const
allClasses
=
className
+
(
display
?
'
'
:
'
dome-control-erased
'
)
+
(
props
.
className
||
''
);
return
(
<
label
className
=
{
allClasses
}
title
=
{
props
.
title
}
style
=
{
props
.
style
}
>
{
props
.
icon
&&
<
Icon
title
=
{
props
.
title
}
id
=
{
props
.
icon
}
/>
}
{
props
.
label
}
{
props
.
text
}
{
props
.
children
}
<
/label
>
);
};
// --------------------------------------------------------------------------
// --- CSS Classes
// --------------------------------------------------------------------------
const
LABEL
=
"
dome-xLabel dome-text-label
"
;
const
TITLE
=
"
dome-xLabel dome-text-title
"
;
const
DESCR
=
"
dome-xLabel dome-text-descr
"
;
const
TDATA
=
"
dome-xLabel dome-text-data
"
;
const
TCODE
=
"
dome-xLabel dome-text-code
"
;
// --------------------------------------------------------------------------
// --- Components
// --------------------------------------------------------------------------
/**
@summary Component labels.
@property {string} [label] - Textual content (prepend to children components, if any)
@property {string} [icon] - Label icon (optional, on left side)
@property {string} [title] - Label tooltip (optional)
@property {string} [className] - Additional class
@property {object} [style] - Additional CSS style
*/
export
const
Label
=
(
props
)
=>
makeLabel
(
LABEL
,
props
);
/**
@summary Title and headings.
@property {string} [label] - Textual content (prepend to children components, if any)
@property {string} [icon] - Label icon (optional, on left side)
@property {string} [title] - Label tooltip (optional)
@property {string} [className] - Additional class
@property {object} [style] - Additional CSS style
*/
export
const
Title
=
(
props
)
=>
makeLabel
(
TITLE
,
props
);
/**
@summary Description, textbook content.
@property {string} [label] - Textual content (prepend to children components, if any)
@property {string} [icon] - Label icon (optional, on left side)
@property {string} [title] - Label tooltip (optional)
@property {string} [className] - Additional class
@property {object} [style] - Additional CSS style
*/
export
const
Descr
=
(
props
)
=>
makeLabel
(
DESCR
,
props
);
/**
@summary Selectable textual information.
@property {string} [label] - Textual content (prepend to children components, if any)
@property {string} [icon] - Label icon (optional, on left side)
@property {string} [title] - Label tooltip (optional)
@property {string} [className] - Additional class
@property {object} [style] - Additional CSS style
*/
export
const
Data
=
(
props
)
=>
makeLabel
(
TDATA
,
props
);
/**
@summary Selectable inlined source-code content.
@property {string} [text] - Textual content (prepend to children components, if any)
@property {string} [icon] - Label icon (optional, on left side)
@property {string} [title] - Label tooltip (optional)
@property {string} [className] - Additional class
@property {object} [style] - Additional CSS style
*/
export
const
Code
=
(
props
)
=>
makeLabel
(
TCODE
,
props
);
// --------------------------------------------------------------------------
This diff is collapsed.
Click to expand it.
ivette/src/dome/src/renderer/controls/labels.tsx
0 → 100644
+
81
−
0
View file @
36804759
// --------------------------------------------------------------------------
// --- Labels
// --------------------------------------------------------------------------
/**
@packageDocumentation
@module dome/controls/labels
*/
import
React
from
'
react
'
;
import
{
Icon
}
from
'
./icons
'
;
import
'
./style.css
'
;
// --------------------------------------------------------------------------
// --- Generic Label
// --------------------------------------------------------------------------
export
interface
LabelProps
{
/** Text of the label. Prepend to other children elements. */
label
?:
string
;
/** Icon identifier. Displayed on the left side of the label. */
icon
?:
string
;
/** Tool-tip description. */
title
?:
string
;
/** Additional class. */
className
?:
string
;
/** Additional style. */
style
?:
React
.
CSSProperties
;
/** If `false`, do not display the label. Default to `true`. */
display
?:
boolean
;
/** Additional content of the `<label/>` element. */
children
?:
any
;
}
const
makeLabel
=
(
className
:
string
,
props
:
LabelProps
)
=>
{
const
{
display
=
true
}
=
props
;
const
allClasses
=
className
+
(
display
?
'
'
:
'
dome-control-erased
'
)
+
(
props
.
className
||
''
);
return
(
<
label
className
=
{
allClasses
}
title
=
{
props
.
title
}
style
=
{
props
.
style
}
>
{
props
.
icon
&&
<
Icon
title
=
{
props
.
title
}
id
=
{
props
.
icon
}
/>
}
{
props
.
label
}
{
props
.
children
}
</
label
>
);
};
// --------------------------------------------------------------------------
// --- CSS Classes
// --------------------------------------------------------------------------
const
LABEL
=
"
dome-xLabel dome-text-label
"
;
const
TITLE
=
"
dome-xLabel dome-text-title
"
;
const
DESCR
=
"
dome-xLabel dome-text-descr
"
;
const
TDATA
=
"
dome-xLabel dome-text-data
"
;
const
TCODE
=
"
dome-xLabel dome-text-code
"
;
// --------------------------------------------------------------------------
// --- Components
// --------------------------------------------------------------------------
/** Simple labels. */
export
const
Label
=
(
props
:
LabelProps
)
=>
makeLabel
(
LABEL
,
props
);
/** Title and headings. */
export
const
Title
=
(
props
:
LabelProps
)
=>
makeLabel
(
TITLE
,
props
);
/** Description, textbook content. */
export
const
Descr
=
(
props
:
LabelProps
)
=>
makeLabel
(
DESCR
,
props
);
/** Selectable textual information. */
export
const
Data
=
(
props
:
LabelProps
)
=>
makeLabel
(
TDATA
,
props
);
/** Selectable inlined source-code content. */
export
const
Code
=
(
props
:
LabelProps
)
=>
makeLabel
(
TCODE
,
props
);
// --------------------------------------------------------------------------
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment