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

feat: Added new icons and added composition example to styleguide #1294

Merged
merged 1 commit into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.