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

Implement accordion and tabs #35

Merged
merged 25 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b211bce
feat:accordion相關功能新增
pollyTing Aug 1, 2024
cca35e0
feat: tabs相關功能新增
pollyTing Aug 1, 2024
7e5260c
fix:新增import accordion、tabs css
pollyTing Aug 1, 2024
ddc3ac5
fix: add 小宛COLOR
pollyTing Aug 1, 2024
e6602cb
fix: Typo 詞語檢查
pollyTing Aug 1, 2024
552e5e3
fix: import 修正 variables.css / accordion.css (+1 squashed commit)
pollyTing Aug 1, 2024
3fe85db
feat: accordion css add
pollyTing Aug 1, 2024
e50285f
fix: add 多種accordion呈現
pollyTing Aug 2, 2024
d0329e1
fix:處理合併頁面id衝突問題 (+1 squashed commit)
pollyTing Aug 2, 2024
b3a7307
fix:新增accordion.js
pollyTing Aug 2, 2024
df79bb6
fix(accordion&tabs): fix document heading (+2 squashed commits)
pollyTing Aug 2, 2024
4412b31
test: test push
pollyTing Aug 16, 2024
aabb4e0
fix: css compile issue
nonumpa Aug 4, 2024
adc01a3
fix: script url in markdown file, it should combine with absolute_url
nonumpa Aug 4, 2024
f1e2d3b
fix(accordion): align default button style
nonumpa Aug 27, 2024
3fe13d5
remove(doc): remove some of accordion docs which needs references or …
nonumpa Aug 27, 2024
a4a3340
chore(ci): lhci cost a lot of resources, run it only when needed
nonumpa Aug 27, 2024
1380de1
chore(ci): lhci add tabs and accordion
nonumpa Aug 27, 2024
8cba511
remove: accordion.css, use accordion.scss instead
nonumpa Aug 28, 2024
214a739
fix: use sass variable statement instead of css, and fix uparrow brok…
nonumpa Aug 28, 2024
e8b5b6b
fix: accordion item border overlap bug and use rem instead of px
nonumpa Aug 28, 2024
5b1db6e
fix: align accordion.css to support multiple use case and remove usel…
nonumpa Aug 28, 2024
c9a7e25
fix: multiple accordion first item css does not applied issue, move b…
nonumpa Aug 28, 2024
aa4d153
fix: accordion document wording
nonumpa Aug 28, 2024
04b9cfb
remove: accordion checked box-shadow and transition
nonumpa Aug 28, 2024
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
3 changes: 3 additions & 0 deletions .github/workflows/lhci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ on:

# Triggers the workflow when pull request is opened or updated
pull_request:
types: [opened, synchronize, reopened, labeled]

jobs:
lighthouseci:
# Run this job if labeled with 'ci-lighthouse'
if: ${{ github.event.label.name == 'ci-lighthouse' }}
runs-on: ubuntu-latest
steps:
#ref: https://github.com/actions/starter-workflows/tree/main/pages
Expand Down
2 changes: 2 additions & 0 deletions .lighthouserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"http://localhost:4000/components/table/index.html",
"http://localhost:4000/components/textarea/index.html",
"http://localhost:4000/components/warning-text/index.html",
"http://localhost:4000/components/accordion/index.html",
"http://localhost:4000/components/tabs/index.html",
"http://localhost:4000/technology/index.html",
"http://localhost:4000/technology/anti_patterns/index.html",
"http://localhost:4000/technology/internationalization/index.html",
Expand Down
63 changes: 63 additions & 0 deletions _components/accordion/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
layout: main
title: 折疊選單 (Accordion)
maturity: "new"
---

### 常見基本折疊選單

- 預設一次僅可展開一個選單,點擊其他選單會自動關閉先前選單

{% capture html %}{% include accordion/accordion_single.html %}{% endcapture %}
{%
include example.html content=html
%}

#### CSS

- `.accordion`:作為全部`.accordion-item`的容器。
- `.accordion-item`:作為單獨折疊選單的容器。
- `label`:作為單獨折疊選單的 `<label>`。
- `.accordion-body`:作為單獨折疊選單的內容。

### 長開折疊選單

- 展開選單需再次點擊關閉,使折疊選單在開啟另一個選單時保持開啟狀態。

{% capture html %}{% include accordion/accordion_multiple.html %}{% endcapture %}
{%
include example.html content=html
%}

#### CSS

- `.accordion`:作為全部`.accordion-item`的容器。
- `.accordion-item`:作為單獨折疊選單的容器。
- `label`:作為單獨折疊選單的 `<label>`。
- `.accordion-body`:作為單獨折疊選單的內容。
- `data-behavior="multiple"`:作為設定是否可以常開選單的屬性。
- `.btn-toggle`:作為一鍵開合所有選單的元件(請設定於可點擊元件中 Ex: `<button>`)。

#### JavaScript

- 使用 [`accordion.js`](/assets/components/accordion.js)。

### 副標題(摘要)折疊選單

- 可在標題欄新增副標題(摘要),請注意僅在實際需要時添加摘要行,避免按鈕文字太長。

{% capture html %}{% include accordion/accordion_subTitle.html %}{% endcapture %}
{%
include example.html content=html
%}

#### CSS

- `.accordion`:作為全部`.accordion-item`的容器。
- `.accordion-item`:作為單獨折疊選單的容器。
- `label`:作為單獨折疊選單的 `<label>`。
- `.accordion-body`:作為單獨折疊選單的內容。
- `.main-title`:作為主標題的內容。
- `.sub-title`:作為副標題的內容。

<script src="{{ "/assets/js/components/accordion.js" | absolute_url }}" type="module"></script>
2 changes: 1 addition & 1 deletion _components/official-document/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ maturity: "alpha"
{% endcapture %}
{% include example-html.html content=html %}

<script src="/assets/js/components/official-document-element.js" type="module">
<script src="{{ "/assets/js/components/official-document-element.js" | absolute_url }}" type="module"></script>
2 changes: 1 addition & 1 deletion _components/table/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ maturity: "alpha"

- 語音識別系統(Dragon NaturallySpeaking, MacOS/iOS Voice Control)

<script src="/assets/js/components/interactive-table-element.js" type="module">
<script src="{{ "/assets/js/components/interactive-table-element.js" | absolute_url }}" type="module"></script>
22 changes: 22 additions & 0 deletions _components/tabs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
layout: main
title: 頁籤 (Tabs)
maturity: "new"
---

### 常見頁籤

{% capture html %}{% include tabs/tabs.html %}{% endcapture %}
{%
include example.html content=html
%}

#### CSS

- `.tabs`:作為全部頁籤的容器。
- `label .tabs-label`:作為頁籤的標題。
- `.tabs-content`:作為頁籤的內容。

#### 親和力

- 使用 `.tabs-label`,必要使用 `for` 與 `id` 連結 `<label>` 元件與 `<input>` 元件。
2 changes: 1 addition & 1 deletion _components/textarea/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ maturity: "alpha"
- `<li>` 預設就請放入 `data-limit-phrase` 的後半部上限提醒。
- 無論如何,伺服器接收內容時仍須再次驗證字數。

<script src="/assets/js/components/character-count.js" type="module">
<script src="{{ "/assets/js/components/character-count.js" | absolute_url }}" type="module"></script>
31 changes: 31 additions & 0 deletions _includes/accordion/accordion_multiple.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<button class="btn-toggle button button-primary mb2">Toggle All</button>
<div class="accordion" data-behavior="multiple">
<div class="accordion-item">
<input type="checkbox" id="section1_multiple">
<label for="section1_multiple">Accordion Item #1</label>
<div class="accordion-body">
<strong>這是第一個 accordion body.</strong> 預設為關閉狀態,這些class控制整體外觀,以及透過 CSS 轉換顯示和隱藏。您可以使用自訂 CSS
修改其中任何內容或覆寫我們的預設變數,基本上大部分 HTML 都可以放入 <font color="darkpink">.accordion-body</font>中。
</div>
</div>
<div class="accordion-item">
<input type="checkbox" id="section2_multiple">
<label for="section2_multiple">Accordion Item #2</label>
<div class="accordion-body">
<strong>這是第二個 accordion body.</strong>我們嘗試使用list為範例呈現。當然您可以使用其他任何 HTML 元素,包括表格、圖片、影片等。
<ul>
<li>第一個清單</li>
<li>第二個清單</li>
</ul>
</div>
</div>
<div class="accordion-item">
<input type="checkbox" id="section3_multiple">
<label for="section3_multiple">Accordion Item #3</label>
<div class="accordion-body">
<strong>這是第二個 accordion body.</strong>我們嘗試以一段長文字進行呈現。<br />
網頁設計(英語:Web
design)涵蓋了製作和維護網站的許多不同的技能和學科。它包含了網頁圖形設計、介面設計、編寫標準化的代碼和專有軟體、使用者經驗設計,以及搜尋引擎最佳化。通常許多人以團隊協作的方式來工作,各自參與設計過程的各個方面;但有些設計師會參與到任何方面。網頁設計這個術語通常用來描述與網站前端(客戶端)設計相關的設計過程,包括編寫標記式語言。在更廣泛的Web開發領域,網頁設計與網路工程存在交集。網頁設計師應該對網路可用性有一定的認識。如果他們的工作涉及到編寫標記式語言,那麼他們也應該遵循網頁親和力的最新指引。
</div>
</div>
</div>
28 changes: 28 additions & 0 deletions _includes/accordion/accordion_single.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<div class="accordion" data-behavior="single">
<div class="accordion-item">
<input type="checkbox" id="section1_single">
<label for="section1_single">Accordion Item #1</label>
<div class="accordion-body">
<strong>這是第一個 accordion body.</strong> 預設為關閉狀態,這些class控制整體外觀,以及透過 CSS 轉換顯示和隱藏。您可以使用自訂 CSS 修改其中任何內容或覆寫我們的預設變數,基本上大部分 HTML 都可以放入 <font color="darkpink">.accordion-body</font>中。
</div>
</div>
<div class="accordion-item">
<input type="checkbox" id="section2_single">
<label for="section2_single">Accordion Item #2</label>
<div class="accordion-body">
<strong>這是第二個 accordion body.</strong>我們嘗試使用list為範例呈現。當然您可以使用其他任何 HTML 元素,包括表格、圖片、影片等。
<ul>
<li>第一個清單</li>
<li>第二個清單</li>
</ul>
</div>
</div>
<div class="accordion-item">
<input type="checkbox" id="section3_single">
<label for="section3_single">Accordion Item #3</label>
<div class="accordion-body">
<strong>這是第二個 accordion body.</strong>我們嘗試以一段長文字進行呈現。<br/>
網頁設計(英語:Web design)涵蓋了製作和維護網站的許多不同的技能和學科。它包含了網頁圖形設計、介面設計、編寫標準化的代碼和專有軟體、使用者經驗設計,以及搜尋引擎最佳化。通常許多人以團隊協作的方式來工作,各自參與設計過程的各個方面;但有些設計師會參與到任何方面。網頁設計這個術語通常用來描述與網站前端(客戶端)設計相關的設計過程,包括編寫標記式語言。在更廣泛的Web開發領域,網頁設計與網路工程存在交集。網頁設計師應該對網路可用性有一定的認識。如果他們的工作涉及到編寫標記式語言,那麼他們也應該遵循網頁親和力的最新指引。
</div>
</div>
</div>
37 changes: 37 additions & 0 deletions _includes/accordion/accordion_subTitle.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<div class="accordion">
<div class="accordion-item">
<input type="checkbox" id="section1">
<label for="section1">
<span class="main-title">Accordion Item #1</span>
<span class="sub-title">Accordion Item #1 副標題</span>
</label>
<div class="accordion-body">
<strong>這是第一個 accordion body.</strong> 預設為關閉狀態,這些class控制整體外觀,以及透過 CSS 轉換顯示和隱藏。您可以使用自訂 CSS 修改其中任何內容或覆寫我們的預設變數,基本上大部分 HTML 都可以放入 <font color="darkpink">.accordion-body</font> 中。
</div>
</div>
<div class="accordion-item">
<input type="checkbox" id="section2">
<label for="section2">
<span class="main-title">Accordion Item #2</span>
<span class="sub-title">Accordion Item #2 副標題</span>
</label>
<div class="accordion-body">
<strong>這是第二個 accordion body.</strong>我們嘗試使用list為範例呈現。當然您可以使用其他任何 HTML 元素,包括表格、圖片、影片等。
<ul>
<li>第一個清單</li>
<li>第二個清單</li>
</ul>
</div>
</div>
<div class="accordion-item">
<input type="checkbox" id="section3">
<label for="section3">
<span class="main-title">Accordion Item #3</span>
<span class="sub-title">Accordion Item #3 副標題</span>
</label>
<div class="accordion-body">
<strong>這是第二個 accordion body.</strong>我們嘗試以一段長文字進行呈現。<br/>
網頁設計(英語:Web design)涵蓋了製作和維護網站的許多不同的技能和學科。它包含了網頁圖形設計、介面設計、編寫標準化的代碼和專有軟體、使用者經驗設計,以及搜尋引擎最佳化。通常許多人以團隊協作的方式來工作,各自參與設計過程的各個方面;但有些設計師會參與到任何方面。網頁設計這個術語通常用來描述與網站前端(客戶端)設計相關的設計過程,包括編寫標記式語言。在更廣泛的Web開發領域,網頁設計與網路工程存在交集。網頁設計師應該對網路可用性有一定的認識。如果他們的工作涉及到編寫標記式語言,那麼他們也應該遵循網頁親和力的最新指引。
</div>
</div>
</div>
27 changes: 27 additions & 0 deletions _includes/tabs/tabs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

<div class="tabs">
<input type="radio" class="tabs-radio" name="tabs-group1" id="tab1" checked>
<label for="tab1" class="tabs-label">Tab 1</label>
<div class="tabs-content">
<h4>Tab 1 Content</h4>
<p>This is the content of tab 1.</p>
</div>
<input type="radio" class="tabs-radio" name="tabs-group1" id="tab2">
<label for="tab2" class="tabs-label">Tab 2</label>
<div class="tabs-content">
<h4>Tab 2 Content</h4>
<p>This is the content of tab 2.</p>
</div>
<input type="radio" class="tabs-radio" name="tabs-group1" id="tab3">
<label for="tab3" class="tabs-label">Tab 3</label>
<div class="tabs-content">
<h4>Tab 3 Content</h4>
<p>This is the content of tab 3.</p>
</div>
<input type="radio" class="tabs-radio" name="tabs-group1" id="tab4">
<label for="tab4" class="tabs-label">Tab 4</label>
<div class="tabs-content">
<h4>Tab 4 Content</h4>
<p>This is the content of tab 4.</p>
</div>
</div>
Loading
Loading