Skip to content

Commit aeb9c96

Browse files
balzssjoyenjoyer
authored andcommitted
refactor(docs): remove deprecation warning from legacy icons, since they are all deprecated
1 parent 87b135c commit aeb9c96

6 files changed

Lines changed: 10 additions & 64 deletions

File tree

packages/ui-icons/icons.config.cjs

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -45,42 +45,6 @@ const react = {
4545
componentBaseName: 'Icon'
4646
}
4747

48-
const deprecated = {
49-
/* [icon name]: [icon name to use instead]
50-
/* e.g. 'arrow-up': 'arrow' */
51-
'discussion-x': 'x',
52-
'copy-course': 'copy',
53-
'discussion-reply-dark': 'more',
54-
'discussion-reply': 'more',
55-
'discussion-search': 'search',
56-
'search-address-book': 'search',
57-
'rss-add': 'add',
58-
'user-add': 'add',
59-
'materials-required-light': 'materials-required',
60-
'mature-light': 'mature',
61-
'note-dark': 'note',
62-
'note-light': 'note',
63-
'icon-reply-2': 'icon-reply',
64-
'icon-replied': 'icon-reply',
65-
instructure: 'instructure-logo',
66-
'settings-2': 'settings',
67-
'twitter-boxed': 'twitter',
68-
'arrow-left': 'arrow-start',
69-
'arrow-open-left': 'arrow-open-start',
70-
'arrow-open-right': 'arrow-open-end',
71-
'arrow-right': 'arrow-end',
72-
'expand-left': 'expand-start',
73-
'mini-arrow-left': 'mini-arrow-start',
74-
'mini-arrow-right': 'mini-arrow-end',
75-
'move-left': 'move-start',
76-
'move-right': 'move-end',
77-
'text-left': 'text-start',
78-
'text-right': 'text-end',
79-
'toggle-left': 'toggle-start',
80-
'toggle-right': 'toggle-end',
81-
unpublish: 'unpublished'
82-
}
83-
8448
const bidirectional = [
8549
'address-book',
8650
'annotate',
@@ -171,6 +135,5 @@ module.exports = {
171135
svg,
172136
fonts,
173137
react,
174-
deprecated,
175138
bidirectional
176139
}

packages/ui-scripts/lib/icons/build-icons.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,14 @@ export default {
9494

9595
const glyphs = getGlyphData(
9696
svgSourceDir,
97-
config.deprecated,
9897
config.bidirectional,
9998
config.react.componentBaseName
10099
)
101100

102101
// generate svg index
103102
generateSvgIndex(glyphs, config.destination)
104103
// - output: ui-icons/src/generated/svg/index.js
105-
// - fields: variant, glyphName, src (svg), deprecated
104+
// - fields: variant, glyphName, src (svg)
106105

107106
// generate react components
108107
generateReactComponents(glyphs, config.destination)

packages/ui-scripts/lib/icons/generate-legacy-icons-data.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,25 @@ import getGlyphData from './get-glyph-data.js'
2626

2727
export default function generateLegacyIconsData() {
2828
const svgDir = path.join(process.cwd(), 'svg/')
29-
const deprecatedMap = {}
3029
const bidirectionalList = []
3130

3231
const glyphsRaw = getGlyphData(
3332
svgDir,
34-
deprecatedMap,
3533
bidirectionalList,
3634
'Icon'
3735
)
3836

3937
// Group by glyphName to merge Line and Solid variants
4038
return Object.values(
4139
glyphsRaw.reduce(
42-
(acc, { name, glyphName, variant, src, bidirectional, deprecated }) => {
43-
if (!deprecated) {
44-
const existing = acc[glyphName] || { name, glyphName, bidirectional }
45-
const updated = { ...existing }
40+
(acc, { name, glyphName, variant, src, bidirectional }) => {
41+
const existing = acc[glyphName] || { name, glyphName, bidirectional }
42+
const updated = { ...existing }
4643

47-
if (variant === 'Line') updated.lineSrc = src
48-
if (variant === 'Solid') updated.solidSrc = src
44+
if (variant === 'Line') updated.lineSrc = src
45+
if (variant === 'Solid') updated.solidSrc = src
4946

50-
return { ...acc, [glyphName]: updated }
51-
}
52-
return acc
47+
return { ...acc, [glyphName]: updated }
5348
},
5449
{}
5550
)

packages/ui-scripts/lib/icons/generate-react-components.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const NOTICE_HEADER = `/*
5050
`
5151

5252
async function generateIconComponent(glyph) {
53-
const { name, variant, glyphName, deprecated, bidirectional, src } = glyph
53+
const { name, variant, glyphName, bidirectional, src } = glyph
5454

5555
const source = src.match(
5656
/<svg\b[^>]*?(?:viewBox="(\b[^"]*)")?>([\s\S]*?)<\/svg>/
@@ -66,7 +66,6 @@ class ${name}${variant} extends Component<SVGIconProps> {
6666
static glyphName = '${glyphName}'
6767
static variant = '${variant}'
6868
static displayName = '${name}${variant}'
69-
${deprecated ? `static deprecated = true` : ''}
7069
static allowedProps: Array<string> = [ ...SVGIcon.allowedProps ]
7170
7271
ref: Element | null = null
@@ -82,13 +81,6 @@ class ${name}${variant} extends Component<SVGIconProps> {
8281
}
8382
8483
render () {
85-
${
86-
deprecated
87-
? `if (process.env.NODE_ENV !== 'production') {
88-
console.warn('<${name}${variant} /> is deprecated. Please use <${deprecated}${variant} /> instead.')
89-
}`
90-
: ''
91-
}
9284
return (
9385
<SVGIcon
9486
{...this.props}

packages/ui-scripts/lib/icons/generate-svg-index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ export default function generateSvgIndex(glyphs, destination) {
5454
return `export const ${glyph.name}${glyph.variant} = {
5555
variant: "${glyph.variant}",
5656
glyphName: "${glyph.glyphName}",
57-
src: \`${glyph.src}\`,
58-
deprecated: ${!!glyph.deprecated}
57+
src: \`${glyph.src}\`
5958
}`
6059
})
6160
.join('\n\n')

packages/ui-scripts/lib/icons/get-glyph-data.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ function toPascalCase(text) {
3232

3333
export default function getGlyphData(
3434
svgSourceDir,
35-
deprecatedMap,
3635
bidirectionalList,
3736
prefix
3837
) {
@@ -57,8 +56,7 @@ export default function getGlyphData(
5756
glyphName: name,
5857
variant: subdir,
5958
src: fileContent,
60-
bidirectional: bidirectionalList.includes(name),
61-
deprecated: deprecatedMap[name] ?? false
59+
bidirectional: bidirectionalList.includes(name)
6260
})
6361
})
6462
})

0 commit comments

Comments
 (0)