Skip to content

Commit

Permalink
feat: Added new icons and added composition example to styleguide (#1294
Browse files Browse the repository at this point in the history
)

Added dhOrganizationAdd icon for ACL editor and dhAddSmall for
composition if needed somewhere else. Also added composition example to
styleguide.
  • Loading branch information
dsmmcken authored May 15, 2023
1 parent 3f12dd3 commit 97c7ead
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 2 deletions.
76 changes: 75 additions & 1 deletion packages/code-studio/src/styleguide/Icons.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import React, { useState, useEffect } from 'react';
import { dh, IconDefinition } from '@deephaven/icons';
import {
dh,
IconDefinition,
vsOrganization,
dhSquareFilled,
dhAddSmall,
} from '@deephaven/icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Button } from '@deephaven/components';
import PropTypes from 'prop-types';
Expand Down Expand Up @@ -105,11 +111,79 @@ function Icons(): React.ReactElement {
);
});

const compositionExample = `
<div className="fa-md fa-layers">
<FontAwesomeIcon
mask={vsOrganization}
icon={dhSquareFilled}
transform="down-7 right-7"
/>
<FontAwesomeIcon icon={dhAddSmall} />
</div>`;

return (
<div>
<h2 className="ui-title">Icons</h2>

<div className="row">
<div className="col">
<h4>Icon Composition</h4>
<p>
Icons can be used indivudally or composed together using
font-awesome composition:
</p>
<div className="icons">
<div className="icon card">
<FontAwesomeIcon icon={vsOrganization} />
</div>
<div className="icon card">
<FontAwesomeIcon icon={dhSquareFilled} />
</div>
<div className="icon card">
<FontAwesomeIcon icon={dhAddSmall} />
</div>
<div className="icon card">=</div>
<Button
kind="inline"
className="card"
onClick={() => {
// new object, so it always flashes even on same string
copyText(compositionExample)
.then(() => {
setFlashText({
text: <span>Copied composition example</span>,
});
})
.catch(err => {
setFlashText({
text: <span className="text-danger">{err.message}</span>,
});
});
}}
>
<div className="icon">
<div className="fa-md fa-layers">
<FontAwesomeIcon
mask={vsOrganization}
icon={dhSquareFilled}
transform="down-7 right-7"
/>
<FontAwesomeIcon icon={dhAddSmall} />
</div>
</div>
<label>Custom</label>
</Button>
</div>
</div>
</div>
<hr />
<div className="row">
<div className="col">
<h4>All available icons</h4>
<p>
If you cannot find or compose a relevant icon for your use case,
please request a new one to be created from design.
</p>
<div className="form-inline mb-3">
<input
type="search"
Expand Down
3 changes: 2 additions & 1 deletion packages/code-studio/src/styleguide/StyleGuide.scss
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ h5.sub-title {
}
}

.icon {
.icon,
.icon .svg-inline--fa {
font-size: 36px;
}

Expand Down
6 changes: 6 additions & 0 deletions packages/icons/src/icons/add-small.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions packages/icons/src/icons/organization-add.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 97c7ead

Please sign in to comment.