Skip to content

Commit 97c7ead

Browse files
authored
feat: Added new icons and added composition example to styleguide (#1294)
Added dhOrganizationAdd icon for ACL editor and dhAddSmall for composition if needed somewhere else. Also added composition example to styleguide.
1 parent 3f12dd3 commit 97c7ead

4 files changed

Lines changed: 102 additions & 2 deletions

File tree

packages/code-studio/src/styleguide/Icons.tsx

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import React, { useState, useEffect } from 'react';
2-
import { dh, IconDefinition } from '@deephaven/icons';
2+
import {
3+
dh,
4+
IconDefinition,
5+
vsOrganization,
6+
dhSquareFilled,
7+
dhAddSmall,
8+
} from '@deephaven/icons';
39
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
410
import { Button } from '@deephaven/components';
511
import PropTypes from 'prop-types';
@@ -105,11 +111,79 @@ function Icons(): React.ReactElement {
105111
);
106112
});
107113

114+
const compositionExample = `
115+
<div className="fa-md fa-layers">
116+
<FontAwesomeIcon
117+
mask={vsOrganization}
118+
icon={dhSquareFilled}
119+
transform="down-7 right-7"
120+
/>
121+
<FontAwesomeIcon icon={dhAddSmall} />
122+
</div>`;
123+
108124
return (
109125
<div>
110126
<h2 className="ui-title">Icons</h2>
127+
128+
<div className="row">
129+
<div className="col">
130+
<h4>Icon Composition</h4>
131+
<p>
132+
Icons can be used indivudally or composed together using
133+
font-awesome composition:
134+
</p>
135+
<div className="icons">
136+
<div className="icon card">
137+
<FontAwesomeIcon icon={vsOrganization} />
138+
</div>
139+
<div className="icon card">
140+
<FontAwesomeIcon icon={dhSquareFilled} />
141+
</div>
142+
<div className="icon card">
143+
<FontAwesomeIcon icon={dhAddSmall} />
144+
</div>
145+
<div className="icon card">=</div>
146+
<Button
147+
kind="inline"
148+
className="card"
149+
onClick={() => {
150+
// new object, so it always flashes even on same string
151+
copyText(compositionExample)
152+
.then(() => {
153+
setFlashText({
154+
text: <span>Copied composition example</span>,
155+
});
156+
})
157+
.catch(err => {
158+
setFlashText({
159+
text: <span className="text-danger">{err.message}</span>,
160+
});
161+
});
162+
}}
163+
>
164+
<div className="icon">
165+
<div className="fa-md fa-layers">
166+
<FontAwesomeIcon
167+
mask={vsOrganization}
168+
icon={dhSquareFilled}
169+
transform="down-7 right-7"
170+
/>
171+
<FontAwesomeIcon icon={dhAddSmall} />
172+
</div>
173+
</div>
174+
<label>Custom</label>
175+
</Button>
176+
</div>
177+
</div>
178+
</div>
179+
<hr />
111180
<div className="row">
112181
<div className="col">
182+
<h4>All available icons</h4>
183+
<p>
184+
If you cannot find or compose a relevant icon for your use case,
185+
please request a new one to be created from design.
186+
</p>
113187
<div className="form-inline mb-3">
114188
<input
115189
type="search"

packages/code-studio/src/styleguide/StyleGuide.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ h5.sub-title {
118118
}
119119
}
120120

121-
.icon {
121+
.icon,
122+
.icon .svg-inline--fa {
122123
font-size: 36px;
123124
}
124125

Lines changed: 6 additions & 0 deletions
Loading
Lines changed: 19 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)