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: loadable component #1364

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"@fortawesome/fontawesome": "^1.1.3",
"@fortawesome/fontawesome-free-solid": "^5.0.6",
"@fortawesome/react-fontawesome": "^0.0.17",
"@loadable/component": "^5.16.4",
"airbnb-prop-types": "^2.15.0",
"classnames": "^2.2.5",
"date-fns": "^2.30.0",
Expand Down
14 changes: 10 additions & 4 deletions src/components/CompanyAndJobTitle/Overview/SummaryBlock.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import React from 'react';
import PropTypes from 'prop-types';
import loadable from '@loadable/component';

import SalaryDistributionChart from 'common/Charts/SalaryDistributionChart';
import JobTitleDistrubitionChart from 'common/Charts/JobTitleDistrubitionChart';
import AverageWeekWorkTimeView from './AverageWeekWorkTimeView';
import styles from './SummaryBlock.module.css';

const SalaryDistributionChart = loadable(() =>
import('common/Charts/SalaryDistributionChart'),
);
const JobTitleDistributionChart = loadable(() =>
import('common/Charts/JobTitleDistributionChart'),
);

const SummaryBlock = ({
salaryDistribution,
jobAverageSalaries,
Expand All @@ -26,10 +32,10 @@ const SummaryBlock = ({
{jobAverageSalaries && (
<React.Fragment>
<div className={styles.barChart}>
<JobTitleDistrubitionChart data={jobAverageSalaries} />
<JobTitleDistributionChart data={jobAverageSalaries} />
</div>
<div className={styles.barChartSm}>
<JobTitleDistrubitionChart data={jobAverageSalaries} />
<JobTitleDistributionChart data={jobAverageSalaries} />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原拼字有誤,修正 naming

</div>
</React.Fragment>
)}
Expand Down
10 changes: 8 additions & 2 deletions src/components/ExperienceDetail/ChartsZone/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ import cn from 'classnames';
import { generatePath } from 'react-router';
import R from 'ramda';
import ChartWrapper from '../../LandingPage/ChartWrapper';
import SalaryDistributionChart from 'common/Charts/SalaryDistributionChart';
import JobTitleDistributionChart from 'common/Charts/JobTitleDistrubitionChart';
import loadable from '@loadable/component';
import styles from '../../LandingPage/SummarySection.module.css';
import moduleStyles from './ChartsZone.module.css';

const isEmptyOrNull = R.either(R.isEmpty, R.isNil);

const SalaryDistributionChart = loadable(() =>
import('common/Charts/SalaryDistributionChart'),
);
const JobTitleDistributionChart = loadable(() =>
import('common/Charts/JobTitleDistributionChart'),
);

const ChartsZone = ({
experience: {
company: {
Expand Down
9 changes: 7 additions & 2 deletions src/components/LandingPage/SummarySection.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import React, { useState, useMemo } from 'react';
import PropTypes from 'prop-types';
import { zip } from 'ramda';
import loadable from '@loadable/component';
import Carousel, { CarouselPage } from 'common/Carousel';
import ChartWrapper from './ChartWrapper';
import SalaryDistributionChart from 'common/Charts/SalaryDistributionChart';
import JobTitleDistributionChart from 'common/Charts/JobTitleDistrubitionChart';
import styles from './SummarySection.module.css';
const SalaryDistributionChart = loadable(() =>
import('common/Charts/SalaryDistributionChart'),
);
const JobTitleDistributionChart = loadable(() =>
import('common/Charts/JobTitleDistributionChart'),
);

const SummarySection = ({
popularCompanyAverageSalary,
Expand Down
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這個檔案原本取名拼字有錯

File renamed without changes.
23 changes: 23 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,13 @@
dependencies:
regenerator-runtime "^0.13.4"

"@babel/runtime@^7.12.18":
version "7.24.6"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.24.6.tgz#5b76eb89ad45e2e4a0a8db54c456251469a3358e"
integrity sha512-Ja18XcETdEl5mzzACGd+DKgaGJzPTCow7EglgwTmHdwokzDFYh/MHua6lU6DV/hjF2IaOJ4oX2nqnjG7RElKOw==
dependencies:
regenerator-runtime "^0.14.0"

"@babel/runtime@^7.21.0":
version "7.22.5"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.5.tgz#8564dd588182ce0047d55d7a75e93921107b57ec"
Expand Down Expand Up @@ -1607,6 +1614,15 @@
"@jridgewell/resolve-uri" "^3.1.0"
"@jridgewell/sourcemap-codec" "^1.4.14"

"@loadable/component@^5.16.4":
version "5.16.4"
resolved "https://registry.yarnpkg.com/@loadable/component/-/component-5.16.4.tgz#583cb65945a5061ca3c6b90eb34835c154283ff4"
integrity sha512-fJWxx9b5WHX90QKmizo9B+es2so8DnBthI1mbflwCoOyvzEwxiZ/SVDCTtXEnHG72/kGBdzr297SSIekYtzSOQ==
dependencies:
"@babel/runtime" "^7.12.18"
hoist-non-react-statics "^3.3.1"
react-is "^16.12.0"

"@mrmlnc/readdir-enhanced@^2.2.1":
version "2.2.1"
resolved "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz"
Expand Down Expand Up @@ -6304,6 +6320,13 @@ hoist-non-react-statics@^3.3.0:
dependencies:
react-is "^16.7.0"

hoist-non-react-statics@^3.3.1:
version "3.3.2"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45"
integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==
dependencies:
react-is "^16.7.0"

hosted-git-info@^2.1.4:
version "2.8.9"
resolved "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz"
Expand Down