Skip to content

Commit

Permalink
Merge branch 'main' into task/WG-403-Create-Asset-Geometry-Component
Browse files Browse the repository at this point in the history
  • Loading branch information
sophia-massie authored Jan 8, 2025
2 parents 4989ee7 + 4cad581 commit d4344a1
Show file tree
Hide file tree
Showing 12 changed files with 294 additions and 149 deletions.
333 changes: 185 additions & 148 deletions react/package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions react/src/common_components/Button/Button.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.root {
min-width: 100px;
}
49 changes: 49 additions & 0 deletions react/src/common_components/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React from 'react';
import { Button, ButtonProps, ConfigProvider, ThemeConfig } from 'antd';
import styles from './Button.module.css';

const secondaryTheme: ThemeConfig = {
components: {
Button: {
defaultActiveBg: '#f4f4f4',
defaultActiveColor: '#222',
defaultActiveBorderColor: '#026',
defaultBg: '#f4f4f4',
defaultBorderColor: '#222222',
defaultColor: '#222222',
defaultHoverBg: '#aac7ff',
},
},
};

export const SecondaryButton: React.FC<ButtonProps> = (props) => {
return (
<ConfigProvider theme={secondaryTheme}>
<Button className={styles.root} {...props} />
</ConfigProvider>
);
};

const primaryButtonTheme: ThemeConfig = {
components: {
Button: {
defaultActiveBg: '#74B566',
defaultActiveColor: '#fff',
defaultActiveBorderColor: '#74B566',
defaultBg: '#74B566',
defaultBorderColor: '#74B566',
defaultColor: '#fff',
defaultHoverBg: '#74b566d9',
defaultHoverBorderColor: '#74b566d9',
defaultHoverColor: '#fff',
},
},
};

export const PrimaryButton: React.FC<ButtonProps> = (props) => {
return (
<ConfigProvider theme={primaryButtonTheme}>
<Button className={styles.root} {...props} />
</ConfigProvider>
);
};
1 change: 1 addition & 0 deletions react/src/common_components/Button/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Button';
Empty file.
11 changes: 11 additions & 0 deletions react/src/common_components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';
import './Icon.module.css';

const Icon: React.FC<{ className: string; label: string }> = ({
className,
label,
}) => {
return <i className={className} role="img" aria-label={label} />;
};

export default Icon;
1 change: 1 addition & 0 deletions react/src/common_components/Icon/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as Icon } from './Icon';
5 changes: 5 additions & 0 deletions react/src/common_components/Spinner/Spinner.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.spinner {
position: absolute;
top: 50%;
width: 100%;
}
7 changes: 7 additions & 0 deletions react/src/common_components/Spinner/Spinner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Spin } from 'antd';
import React from 'react';
import styles from './Spinner.module.css';

const Spinner: React.FC = () => <Spin className={styles.spinner} />;

export default Spinner;
1 change: 1 addition & 0 deletions react/src/common_components/Spinner/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as Spinner } from './Spinner';
3 changes: 3 additions & 0 deletions react/src/common_components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { PrimaryButton, SecondaryButton } from './Button';
export { Icon } from './Icon';
export { Spinner } from './Spinner';
29 changes: 28 additions & 1 deletion react/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,39 @@ import './index.css';
import store from './redux/store';
import { Provider } from 'react-redux';
import { queryClient } from './queryClient';
import { ConfigProvider, ThemeConfig } from 'antd';

const themeConfig: ThemeConfig = {
token: {
borderRadius: 0,
colorPrimary: '#337ab7',
colorError: '#d9534f',
colorPrimaryTextHover: 'black',
colorBorderSecondary: '#b7b7b7',
},
components: {
Table: {
cellPaddingBlock: 8,
headerBg: 'transparent',
headerColor: '#333333',
headerSplitColor: 'transparent',
rowHoverBg: 'rgb(230, 246, 255)',
borderColor: 'rgb(215, 215, 215)',
colorText: 'rgb(112, 112, 112)',
},
Layout: {
bodyBg: 'transparent',
},
},
};

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
<Provider store={store}>
<QueryClientProvider client={queryClient}>
<App />
<ConfigProvider theme={themeConfig}>
<App />
</ConfigProvider>
</QueryClientProvider>
</Provider>
</React.StrictMode>
Expand Down

0 comments on commit d4344a1

Please sign in to comment.